* [PATCH] PCI: Remove redundant pci_dev_unlock() in pci_slot_trylock()
@ 2025-12-11 12:36 Jinhui Guo
2025-12-11 18:13 ` Ilpo Järvinen
0 siblings, 1 reply; 3+ messages in thread
From: Jinhui Guo @ 2025-12-11 12:36 UTC (permalink / raw)
To: bhelgaas, kbusch, dave.jiang, dan.j.williams
Cc: guojinhui.liam, linux-pci, linux-kernel, stable
Commit a4e772898f8b ("PCI: Add missing bridge lock to pci_bus_lock()")
delegates the bridge device's pci_dev_trylock() to pci_bus_trylock()
in pci_slot_trylock(), but it leaves a redundant pci_dev_unlock() when
pci_bus_trylock() fails.
Remove the redundant bridge-device pci_dev_unlock() in pci_slot_trylock(),
since that lock is no longer taken there.
Fixes: a4e772898f8b ("PCI: Add missing bridge lock to pci_bus_lock()")
Cc: stable@vger.kernel.org
Signed-off-by: Jinhui Guo <guojinhui.liam@bytedance.com>
---
drivers/pci/pci.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 13dbb405dc31..75a98819db6f 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -5347,7 +5347,6 @@ static int pci_slot_trylock(struct pci_slot *slot)
continue;
if (dev->subordinate) {
if (!pci_bus_trylock(dev->subordinate)) {
- pci_dev_unlock(dev);
goto unlock;
}
} else if (!pci_dev_trylock(dev))
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] PCI: Remove redundant pci_dev_unlock() in pci_slot_trylock()
2025-12-11 12:36 [PATCH] PCI: Remove redundant pci_dev_unlock() in pci_slot_trylock() Jinhui Guo
@ 2025-12-11 18:13 ` Ilpo Järvinen
2025-12-12 13:47 ` Jinhui Guo
0 siblings, 1 reply; 3+ messages in thread
From: Ilpo Järvinen @ 2025-12-11 18:13 UTC (permalink / raw)
To: Jinhui Guo
Cc: bhelgaas, kbusch, dave.jiang, dan.j.williams, linux-pci, LKML,
stable
On Thu, 11 Dec 2025, Jinhui Guo wrote:
> Commit a4e772898f8b ("PCI: Add missing bridge lock to pci_bus_lock()")
> delegates the bridge device's pci_dev_trylock() to pci_bus_trylock()
> in pci_slot_trylock(), but it leaves a redundant pci_dev_unlock() when
> pci_bus_trylock() fails.
>
> Remove the redundant bridge-device pci_dev_unlock() in pci_slot_trylock(),
> since that lock is no longer taken there.
Doesn't it cause issues if trying to unlock something that wasn't locked
so saying its "redundant" seem a bit an understatement?
> Fixes: a4e772898f8b ("PCI: Add missing bridge lock to pci_bus_lock()")
> Cc: stable@vger.kernel.org
> Signed-off-by: Jinhui Guo <guojinhui.liam@bytedance.com>
> ---
> drivers/pci/pci.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index 13dbb405dc31..75a98819db6f 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -5347,7 +5347,6 @@ static int pci_slot_trylock(struct pci_slot *slot)
> continue;
> if (dev->subordinate) {
> if (!pci_bus_trylock(dev->subordinate)) {
> - pci_dev_unlock(dev);
> goto unlock;
> }
> } else if (!pci_dev_trylock(dev))
>
--
i.
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] PCI: Remove redundant pci_dev_unlock() in pci_slot_trylock()
2025-12-11 18:13 ` Ilpo Järvinen
@ 2025-12-12 13:47 ` Jinhui Guo
0 siblings, 0 replies; 3+ messages in thread
From: Jinhui Guo @ 2025-12-12 13:47 UTC (permalink / raw)
To: ilpo.jarvinen
Cc: bhelgaas, dan.j.williams, dave.jiang, guojinhui.liam, kbusch,
linux-kernel, linux-pci, stable
On Thu, Dec 11, 2025 20:13:59 +0200, Ilpo Järvinen wrote:
> > Commit a4e772898f8b ("PCI: Add missing bridge lock to pci_bus_lock()")
> > delegates the bridge device's pci_dev_trylock() to pci_bus_trylock()
> > in pci_slot_trylock(), but it leaves a redundant pci_dev_unlock() when
> > pci_bus_trylock() fails.
> >
> > Remove the redundant bridge-device pci_dev_unlock() in pci_slot_trylock(),
> > since that lock is no longer taken there.
>
> Doesn't it cause issues if trying to unlock something that wasn't locked
> so saying its "redundant" seem a bit an understatement?
Hi, Ilpo Järvinen
Thanks for your time. The commit message was a bit brief, so I've sent v2
https://lore.kernel.org/all/20251212133737.2367-1-guojinhui.liam@bytedance.com/
with more details.
Best Regards,
Jinhui
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-12-12 13:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-11 12:36 [PATCH] PCI: Remove redundant pci_dev_unlock() in pci_slot_trylock() Jinhui Guo
2025-12-11 18:13 ` Ilpo Järvinen
2025-12-12 13:47 ` Jinhui Guo
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.