summaryrefslogtreecommitdiff
path: root/drivers/power
diff options
context:
space:
mode:
authorJonghwa Lee <jonghwa3.lee@samsung.com>2013-06-25 05:02:49 (GMT)
committerAnton Vorontsov <anton@enomsg.org>2013-06-29 01:35:49 (GMT)
commit3cc9d26966ea02f71258ab0553ebd3388f40533a (patch)
tree4a4253d83e24966a176bf399a9ac46ec1e351343 /drivers/power
parent605860bc2495cd584fd639f00806591af0b1fefa (diff)
downloadlinux-fsl-qoriq-3cc9d26966ea02f71258ab0553ebd3388f40533a.tar.xz
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> Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com> Acked-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/charger-manager.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/power/charger-manager.c b/drivers/power/charger-manager.c
index ba42029..8ad9698 100644
--- a/drivers/power/charger-manager.c
+++ b/drivers/power/charger-manager.c
@@ -1666,7 +1666,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);