Skip to content

Commit

Permalink
charger-manager: Fix a bug when it unregisters notifier block of extcon
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jonghwa Lee authored and Anton Vorontsov committed Jun 29, 2013
1 parent 605860b commit 3cc9d26
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/power/charger-manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -1666,7 +1666,9 @@ static int charger_manager_probe(struct platform_device *pdev)
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);
Expand Down

0 comments on commit 3cc9d26

Please sign in to comment.