diff options
author | Jonghwa Lee <jonghwa3.lee@samsung.com> | 2013-07-16 17:22:29 +0900 |
---|---|---|
committer | Chanho Park <chanho61.park@samsung.com> | 2014-11-18 11:43:26 +0900 |
commit | 212c4b03d09d9aa855332096f8a56c80994b34f4 (patch) | |
tree | 883df46f4d99b9c9cbb212a677e96702ad5033a3 /drivers | |
parent | 9793c9e63d73b805524de4c1de8618965ba93635 (diff) | |
download | linux-3.10-212c4b03d09d9aa855332096f8a56c80994b34f4.tar.gz linux-3.10-212c4b03d09d9aa855332096f8a56c80994b34f4.tar.bz2 linux-3.10-212c4b03d09d9aa855332096f8a56c80994b34f4.zip |
power: charger-manager: Fix a bug when it unregisters notifier block of extcon.
This patch prevents NULL pointer error cauesed by unregistering unregistered
exton notifier block. At the probing time of charger manager, it tries to
remove extcon notifier block when it fails to initialize them. It has to be
applied for only registered one. Otherwise, it'd make kernel panic. To make it
work right, it checks extcon_specific_cable_nb's extcon_dev node. If extcon
cable notifier block was registered successfully, it has proper extcon_dev
pointer if not so it has NULL pointer.
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/power/charger-manager.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/power/charger-manager.c b/drivers/power/charger-manager.c index 4092bd8c277..7946b8a0abd 100644 --- a/drivers/power/charger-manager.c +++ b/drivers/power/charger-manager.c @@ -1800,7 +1800,9 @@ err_reg_extcon: charger = &desc->charger_regulators[i]; for (j = 0; j < charger->num_cables; j++) { struct charger_cable *cable = &charger->cables[j]; - extcon_unregister_interest(&cable->extcon_dev); + /* Remove notifier block if only edev exists */ + if (cable->extcon_dev.edev) + extcon_unregister_interest(&cable->extcon_dev); } regulator_put(desc->charger_regulators[i].consumer); |