From: Krzysztof Kozlowski Date: Tue, 24 Mar 2015 07:58:43 +0000 (+0100) Subject: power_supply: charger-manager: Fix dereferencing of ERR_PTR X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ecf896b97de9757fd835034ad849680218babc93;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git 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 Reported-by: Dan Carpenter Signed-off-by: Sebastian Reichel --- 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); }