* [PATCH] power_supply: charger-manager: Fix dereferencing of ERR_PTR
@ 2015-03-24 7:58 Krzysztof Kozlowski
2015-03-24 15:08 ` Sebastian Reichel
0 siblings, 1 reply; 2+ messages in thread
From: Krzysztof Kozlowski @ 2015-03-24 7:58 UTC (permalink / raw)
To: Sebastian Reichel, Dmitry Eremin-Solenikov, David Woodhouse,
linux-pm, linux-kernel
Cc: Dan Carpenter, Krzysztof Kozlowski
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>
---
drivers/power/charger-manager.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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);
}
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] power_supply: charger-manager: Fix dereferencing of ERR_PTR
2015-03-24 7:58 [PATCH] power_supply: charger-manager: Fix dereferencing of ERR_PTR Krzysztof Kozlowski
@ 2015-03-24 15:08 ` Sebastian Reichel
0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Reichel @ 2015-03-24 15:08 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Dmitry Eremin-Solenikov, David Woodhouse, linux-pm, linux-kernel,
Dan Carpenter
[-- Attachment #1: Type: text/plain, Size: 513 bytes --]
Hi Krzysztof,
On Tue, Mar 24, 2015 at 08:58:43AM +0100, Krzysztof Kozlowski wrote:
> 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>
Thanks, pulled.
-- Sebastian
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-03-24 15:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-24 7:58 [PATCH] power_supply: charger-manager: Fix dereferencing of ERR_PTR Krzysztof Kozlowski
2015-03-24 15:08 ` Sebastian Reichel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox