Re: [PATCH] PCI: fix double put_device() in error case in pci_create_root_bus()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Helgaas,

On 2022/10/18 18:38, Thierry Reding wrote:
On Tue, Oct 18, 2022 at 11:51:34AM +0800, Yang Yingliang wrote:
If device_add() fails in pci_register_host_bridge(), the bridge device will
be put once, and it will be put again in error path of pci_create_root_bus().
Fix this by removing put_device() after device_add() is failed.
I think it's a obvious problem.
Is this patch look good to you or any suggestion?

Thanks,
Yang

Fixes: 37d6a0a6f470 ("PCI: Add pci_register_host_bridge() interface")
Signed-off-by: Yang Yingliang <yangyingliang@xxxxxxxxxx>
---
  drivers/pci/probe.c | 4 +---
  1 file changed, 1 insertion(+), 3 deletions(-)
Seems fine. All callers, as far as I can tell, of this end up invoking
pci_free_host_bridge() which does the corresponding put_device() itself:

Reviewed-by: Thierry Reding <treding@xxxxxxxxxx>



[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux