]> Pileus Git - ~andy/linux/blobdiff - drivers/base/devres.c
Merge branch 'perfcounters-fixes-for-linus' of git://git.kernel.org/pub/scm/linux...
[~andy/linux] / drivers / base / devres.c
index e8beb8e5b6264232dbfc0ea2dc7ae95d76f5af64..05dd307e8f024038bfe6e9d762e3dff1dd6281ee 100644 (file)
@@ -428,6 +428,9 @@ int devres_release_all(struct device *dev)
 {
        unsigned long flags;
 
+       /* Looks like an uninitialized device structure */
+       if (WARN_ON(dev->devres_head.next == NULL))
+               return -ENODEV;
        spin_lock_irqsave(&dev->devres_lock, flags);
        return release_nodes(dev, dev->devres_head.next, &dev->devres_head,
                             flags);