* [patch] power/max8925: freeing wrong variable
@ 2016-03-18 5:40 Dan Carpenter
2016-04-10 16:27 ` Sebastian Reichel
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2016-03-18 5:40 UTC (permalink / raw)
To: Sebastian Reichel, Haojian Zhuang
Cc: Dmitry Eremin-Solenikov, David Woodhouse, linux-pm, linux-kernel,
kernel-janitors
We were freeing "info->battery" instead of "info->usb", which leads to
an OOps and a resource leak.
The labels were wonky, "out_battery" did release the battery but out_usb
did not release usb. I was introducing a call to free usb so it sort
conflicted with existing misleading name. I renamed them.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/power/max8925_power.c b/drivers/power/max8925_power.c
index 57eb5c2..3b94620 100644
--- a/drivers/power/max8925_power.c
+++ b/drivers/power/max8925_power.c
@@ -540,14 +540,14 @@ static int max8925_power_probe(struct platform_device *pdev)
info->usb = power_supply_register(&pdev->dev, &usb_desc, &psy_cfg);
if (IS_ERR(info->usb)) {
ret = PTR_ERR(info->usb);
- goto out_usb;
+ goto out_unregister_ac;
}
info->usb->dev.parent = &pdev->dev;
info->battery = power_supply_register(&pdev->dev, &battery_desc, NULL);
if (IS_ERR(info->battery)) {
ret = PTR_ERR(info->battery);
- goto out_battery;
+ goto out_unregister_usb;
}
info->battery->dev.parent = &pdev->dev;
@@ -560,9 +560,9 @@ static int max8925_power_probe(struct platform_device *pdev)
max8925_init_charger(chip, info);
return 0;
-out_battery:
- power_supply_unregister(info->battery);
-out_usb:
+out_unregister_usb:
+ power_supply_unregister(info->usb);
+out_unregister_ac:
power_supply_unregister(info->ac);
out:
return ret;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [patch] power/max8925: freeing wrong variable
2016-03-18 5:40 [patch] power/max8925: freeing wrong variable Dan Carpenter
@ 2016-04-10 16:27 ` Sebastian Reichel
0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Reichel @ 2016-04-10 16:27 UTC (permalink / raw)
To: Dan Carpenter
Cc: Haojian Zhuang, Dmitry Eremin-Solenikov, David Woodhouse,
linux-pm, linux-kernel, kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 490 bytes --]
Hi,
On Fri, Mar 18, 2016 at 08:40:16AM +0300, Dan Carpenter wrote:
> We were freeing "info->battery" instead of "info->usb", which leads to
> an OOps and a resource leak.
>
> The labels were wonky, "out_battery" did release the battery but out_usb
> did not release usb. I was introducing a call to free usb so it sort
> conflicted with existing misleading name. I renamed them.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Thanks, queued.
-- Sebastian
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-04-10 16:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-18 5:40 [patch] power/max8925: freeing wrong variable Dan Carpenter
2016-04-10 16:27 ` Sebastian Reichel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).