2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-28 07:04:00 +08:00

devres: No need to call remove_nodes() when there none present

If a list of devres nodes is empty, no need to call remove_nodes().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20210517122946.53161-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Andy Shevchenko 2021-05-17 15:29:45 +03:00 committed by Greg Kroah-Hartman
parent c3cd0ff7aa
commit a7f1d03b60

View File

@ -526,6 +526,10 @@ int devres_release_all(struct device *dev)
if (WARN_ON(dev->devres_head.next == NULL))
return -ENODEV;
/* Nothing to release if list is empty */
if (list_empty(&dev->devres_head))
return 0;
spin_lock_irqsave(&dev->devres_lock, flags);
cnt = remove_nodes(dev, dev->devres_head.next, &dev->devres_head, &todo);
spin_unlock_irqrestore(&dev->devres_lock, flags);