提交 3cc9d269 编写于 作者: J Jonghwa Lee 提交者: Anton Vorontsov

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: NJonghwa Lee <jonghwa3.lee@samsung.com>
Signed-off-by: NMyungjoo Ham <myungjoo.ham@samsung.com>
Acked-by: NChanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: NAnton Vorontsov <anton@enomsg.org>
上级 605860bc
...@@ -1666,7 +1666,9 @@ static int charger_manager_probe(struct platform_device *pdev) ...@@ -1666,7 +1666,9 @@ static int charger_manager_probe(struct platform_device *pdev)
charger = &desc->charger_regulators[i]; charger = &desc->charger_regulators[i];
for (j = 0; j < charger->num_cables; j++) { for (j = 0; j < charger->num_cables; j++) {
struct charger_cable *cable = &charger->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); regulator_put(desc->charger_regulators[i].consumer);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册