diff options
-rw-r--r-- | drivers/base/devres.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/base/devres.c b/drivers/base/devres.c index e8beb8e..05dd307 100644 --- a/drivers/base/devres.c +++ b/drivers/base/devres.c @@ -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); |