power: supply: ab8500: Fix error handling in ab8500_charger_init()
The ab8500_charger_init() returns the platform_driver_register() directly
without checking its return value, if platform_driver_register() failed,
all ab8500_charger_component_drivers are not unregistered.
Fix by unregister ab8500_charger_component_drivers when
platform_driver_register() failed.
Fixes: 1c1f13a006
("power: supply: ab8500: Move to componentized binding")
Signed-off-by: Yuan Can <yuancan@huawei.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
This commit is contained in:
parent
97f2b4ddb0
commit
c4d33381b1
@ -3719,7 +3719,14 @@ static int __init ab8500_charger_init(void)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return platform_driver_register(&ab8500_charger_driver);
|
||||
ret = platform_driver_register(&ab8500_charger_driver);
|
||||
if (ret) {
|
||||
platform_unregister_drivers(ab8500_charger_component_drivers,
|
||||
ARRAY_SIZE(ab8500_charger_component_drivers));
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void __exit ab8500_charger_exit(void)
|
||||
|
Loading…
Reference in New Issue
Block a user