Skip to content

Commit

Permalink
power_supply: charger-manager: Fix dereferencing of ERR_PTR
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Krzysztof Kozlowski authored and Sebastian Reichel committed Mar 24, 2015
1 parent fbea947 commit ecf896b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/power/charger-manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit ecf896b

Please sign in to comment.