Re: [PATCH] PCI: Remove redundant pci_dev_unlock() in pci_slot_trylock()
From: Ilpo Järvinen
Date: Thu Dec 11 2025 - 13:14:05 EST
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@xxxxxxxxxxxxxxx
> Signed-off-by: Jinhui Guo <guojinhui.liam@xxxxxxxxxxxxx>
> ---
> 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.