Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

devres: remove unnecessary unlocks in devres_release_group()

There is no need to call spin_unlock_irqrestore() in every conditional
block, as release_nodes() can safely be called with an empty list, in
case we hit the "if else" or "else" case.

We do not use a scoped_guard() here to not unnecessarily change the
indentation level.

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://patch.msgid.link/20260202235210.55176-8-dakr@kernel.org
Signed-off-by: Danilo Krummrich <dakr@kernel.org>

+3 -6
+3 -6
drivers/base/devres.c
··· 712 712 int cnt = 0; 713 713 714 714 spin_lock_irqsave(&dev->devres_lock, flags); 715 - 716 715 grp = find_group(dev, id); 717 716 if (grp) { 718 717 struct list_head *first = &grp->node[0].entry; ··· 721 722 end = grp->node[1].entry.next; 722 723 723 724 cnt = remove_nodes(dev, first, end, &todo); 724 - spin_unlock_irqrestore(&dev->devres_lock, flags); 725 - 726 - release_nodes(dev, &todo); 727 725 } else if (list_empty(&dev->devres_head)) { 728 726 /* 729 727 * dev is probably dying via devres_release_all(): groups 730 728 * have already been removed and are on the process of 731 729 * being released - don't touch and don't warn. 732 730 */ 733 - spin_unlock_irqrestore(&dev->devres_lock, flags); 734 731 } else { 735 732 WARN_ON(1); 736 - spin_unlock_irqrestore(&dev->devres_lock, flags); 737 733 } 734 + spin_unlock_irqrestore(&dev->devres_lock, flags); 735 + 736 + release_nodes(dev, &todo); 738 737 739 738 return cnt; 740 739 }