linux/drivers/ntb/hw
Yuan Can 98af0a33c1 NTB: amd: Fix error handling in amd_ntb_pci_driver_init()
A problem about ntb_hw_amd create debugfs failed is triggered with the
following log given:

 [  618.431232] AMD(R) PCI-E Non-Transparent Bridge Driver 1.0
 [  618.433284] debugfs: Directory 'ntb_hw_amd' with parent '/' already present!

The reason is that amd_ntb_pci_driver_init() returns pci_register_driver()
directly without checking its return value, if pci_register_driver()
failed, it returns without destroy the newly created debugfs, resulting
the debugfs of ntb_hw_amd can never be created later.

 amd_ntb_pci_driver_init()
   debugfs_create_dir() # create debugfs directory
   pci_register_driver()
     driver_register()
       bus_add_driver()
         priv = kzalloc(...) # OOM happened
   # return without destroy debugfs directory

Fix by removing debugfs when pci_register_driver() returns error.

Fixes: a1b3695820 ("NTB: Add support for AMD PCI-Express Non-Transparent Bridge")
Signed-off-by: Yuan Can <yuancan@huawei.com>
Signed-off-by: Jon Mason <jdmason@kudzu.us>
2023-07-08 10:51:55 -04:00
..
amd NTB: amd: Fix error handling in amd_ntb_pci_driver_init() 2023-07-08 10:51:55 -04:00
epf NTB: epf: Allow more flexibility in the memory BAR map method 2022-08-09 17:54:03 -04:00
idt ntb: idt: Fix error handling in idt_pci_driver_init() 2023-07-08 10:51:55 -04:00
intel ntb: intel: add GNR support for Intel PCIe gen5 NTB 2022-08-09 11:54:41 -04:00
mscc driver core: class: remove struct class_interface * from callbacks 2023-04-03 21:42:52 +02:00
Kconfig NTB: Add support for EPF PCI Non-Transparent Bridge 2021-02-23 14:12:53 -06:00
Makefile NTB: Add support for EPF PCI Non-Transparent Bridge 2021-02-23 14:12:53 -06:00