android_kernel_samsung_sm8650/drivers/ntb/hw
Yuan Can bece67815a ntb: intel: Fix error handling in intel_ntb_pci_driver_init()
[ Upstream commit 4c3c796aca02883ad35bb117468938cc4022ca41 ]

A problem about ntb_hw_intel create debugfs failed is triggered with the
following log given:

 [  273.112733] Intel(R) PCI-E Non-Transparent Bridge Driver 2.0
 [  273.115342] debugfs: Directory 'ntb_hw_intel' with parent '/' already present!

The reason is that intel_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_intel can never be created later.

 intel_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: e26a5843f7 ("NTB: Split ntb_hw_intel and ntb_transport drivers")
Signed-off-by: Yuan Can <yuancan@huawei.com>
Acked-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Jon Mason <jdmason@kudzu.us>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-07-23 13:49:23 +02:00
..
amd NTB: amd: Fix error handling in amd_ntb_pci_driver_init() 2023-07-23 13:49:23 +02: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-23 13:49:23 +02:00
intel ntb: intel: Fix error handling in intel_ntb_pci_driver_init() 2023-07-23 13:49:23 +02:00
mscc ntb_hw_switchtec: Fix a minor issue in config_req_id_table() 2022-01-11 15:38:59 -05: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