Skip to content

Commit 48f703d

Browse files
Dan Carpentersre
authored andcommitted
power: supply: max1720x: fix a double free on error in probe()
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: 47271a9 ("power: supply: max1720x: add read support for nvmem") Signed-off-by: Dan Carpenter <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sebastian Reichel <[email protected]>
1 parent 6625767 commit 48f703d

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

drivers/power/supply/max1720x_battery.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,6 @@ static int max1720x_probe_nvmem(struct i2c_client *client,
427427

428428
ret = devm_add_action_or_reset(dev, max1720x_unregister_ancillary, info);
429429
if (ret) {
430-
i2c_unregister_device(info->ancillary);
431430
dev_err(dev, "Failed to add unregister callback\n");
432431
return ret;
433432
}

0 commit comments

Comments
 (0)