* [PATCH next] power: supply: fix a double free on error in probe()
@ 2024-09-05 13:28 Dan Carpenter
2024-09-05 14:32 ` Sebastian Reichel
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2024-09-05 13:28 UTC (permalink / raw)
To: Dimitri Fedrau; +Cc: Sebastian Reichel, linux-pm, linux-kernel, kernel-janitors
In this code, if devm_add_action_or_reset() fails, it will call
max1720x_unregister_ancillary() which in turn calls
i2c_unregister_device(). Thus the call to i2c_unregister_device() on the
following line is not required and is a double unregister. Delete it.
Fixes: 47271a935619 ("power: supply: max1720x: add read support for nvmem")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
From code review, not tested.
drivers/power/supply/max1720x_battery.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/power/supply/max1720x_battery.c b/drivers/power/supply/max1720x_battery.c
index 3e84e70340e4..2bc3dce963a3 100644
--- a/drivers/power/supply/max1720x_battery.c
+++ b/drivers/power/supply/max1720x_battery.c
@@ -427,7 +427,6 @@ static int max1720x_probe_nvmem(struct i2c_client *client,
ret = devm_add_action_or_reset(dev, max1720x_unregister_ancillary, info);
if (ret) {
- i2c_unregister_device(info->ancillary);
dev_err(dev, "Failed to add unregister callback\n");
return ret;
}
--
2.45.2
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH next] power: supply: fix a double free on error in probe()
2024-09-05 13:28 [PATCH next] power: supply: fix a double free on error in probe() Dan Carpenter
@ 2024-09-05 14:32 ` Sebastian Reichel
0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Reichel @ 2024-09-05 14:32 UTC (permalink / raw)
To: Dimitri Fedrau, Dan Carpenter
Cc: Sebastian Reichel, linux-pm, linux-kernel, kernel-janitors
On Thu, 05 Sep 2024 16:28:59 +0300, Dan Carpenter wrote:
> In this code, if devm_add_action_or_reset() fails, it will call
> max1720x_unregister_ancillary() which in turn calls
> i2c_unregister_device(). Thus the call to i2c_unregister_device() on the
> following line is not required and is a double unregister. Delete it.
>
>
Applied, thanks!
[1/1] power: supply: fix a double free on error in probe()
commit: 48f703d6a3d7cf345fe9c6209ea3703fe9024628
Best regards,
--
Sebastian Reichel <sebastian.reichel@collabora.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-09-05 14:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-05 13:28 [PATCH next] power: supply: fix a double free on error in probe() Dan Carpenter
2024-09-05 14:32 ` Sebastian Reichel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®