linux/drivers/misc/eeprom
Yuan Can d717a3ab28 eeprom: idt_89hpesx: Fix error handling in idt_init()
A problem about idt_89hpesx create debugfs failed is triggered with the
following log given:

 [ 4973.269647] debugfs: Directory 'idt_csr' with parent '/' already present!

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

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

Fix by removing debugfs when i2c_add_driver() returns error.

Fixes: cfad642538 ("eeprom: Add IDT 89HPESx EEPROM/CSR driver")
Signed-off-by: Yuan Can <yuancan@huawei.com>
Acked-by: Serge Semin <fancer.lancer@gmail.com>
Link: https://lore.kernel.org/r/20221110020030.47711-1-yuancan@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-01-20 12:05:26 +01:00
..
at24.c i2c: Make remove callback return void 2022-08-16 12:46:26 +02:00
at25.c eeprom: at25: Convert to use fwnode_device_is_compatible() 2023-01-20 12:05:01 +01:00
digsy_mtc_eeprom.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
ee1004.c i2c: Make remove callback return void 2022-08-16 12:46:26 +02:00
eeprom_93cx6.c misc: eeprom: eeprom_93cx6: Repair function arg descriptions 2020-06-29 18:45:52 +02:00
eeprom_93xx46.c spi: make remove callback a void function 2022-02-09 13:00:45 +00:00
eeprom.c misc: eeprom/eeprom: Convert to i2c's .probe_new() 2022-11-23 19:56:03 +01:00
idt_89hpesx.c eeprom: idt_89hpesx: Fix error handling in idt_init() 2023-01-20 12:05:26 +01:00
Kconfig nvmem: prepare basics for FRAM support 2021-06-11 12:23:10 +02:00
Makefile eeprom: New ee1004 driver for DDR4 memory 2018-10-15 20:51:46 +02:00
max6875.c misc: eeprom/max6875: Convert to i2c's .probe_new() 2022-11-23 19:56:08 +01:00