summaryrefslogtreecommitdiffstats
path: root/drivers/power/charger-manager.c
diff options
context:
space:
mode:
authorKrzysztof Kozlowski <k.kozlowski@samsung.com>2015-03-24 08:58:43 +0100
committerSebastian Reichel <sre@kernel.org>2015-03-24 13:40:14 +0100
commitecf896b97de9757fd835034ad849680218babc93 (patch)
treef092533f379bc3f6360d977b1583ead5d46c48cc /drivers/power/charger-manager.c
parentfbea947c7d122f4704001fac2a96b617f767037a (diff)
downloadlinux-ecf896b97de9757fd835034ad849680218babc93.tar.bz2
power_supply: charger-manager: Fix dereferencing of ERR_PTR
If power_supply_register() fails do not dereference returned ERR_PTR. The pointer was dereferenced to print name of battery which registration failed. Instead use the name from the power supply description passed to the power_supply_register() function. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
Diffstat (limited to 'drivers/power/charger-manager.c')
-rw-r--r--drivers/power/charger-manager.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/power/charger-manager.c b/drivers/power/charger-manager.c
index 5933c1a585f4..0aed13f90891 100644
--- a/drivers/power/charger-manager.c
+++ b/drivers/power/charger-manager.c
@@ -1772,7 +1772,7 @@ static int charger_manager_probe(struct platform_device *pdev)
&psy_cfg);
if (IS_ERR(cm->charger_psy)) {
dev_err(&pdev->dev, "Cannot register charger-manager with name \"%s\"\n",
- cm->charger_psy->desc->name);
+ cm->charger_psy_desc.name);
return PTR_ERR(cm->charger_psy);
}