diff mbox series

[10/10] power: supply: bq24190: Free battery_info

Message ID 20250608204010.37482-11-hansg@kernel.org
State New
Headers show
Series power: supply: ug3105_battery: Switch to power_supply_batinfo_ocv2cap() | expand

Commit Message

Hans de Goede June 8, 2025, 8:40 p.m. UTC
Call power_supply_put_battery_info() when bq24190_get_config() is done with
it. The "struct power_supply_battery_info *info" pointer runs out of scope
at the end of bq24190_get_config() so there is no need to keep it around
after this.

Note technically this is not a memleak fix, since all battery_info data is
devm_alloc()-ed so it would still be free-ed when the driver is unbound.
This just frees it as soon as the driver is done with it.

Signed-off-by: Hans de Goede <hansg@kernel.org>
---
 drivers/power/supply/bq24190_charger.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/drivers/power/supply/bq24190_charger.c b/drivers/power/supply/bq24190_charger.c
index f0d97ab45bd8..cc6dad8f8e58 100644
--- a/drivers/power/supply/bq24190_charger.c
+++ b/drivers/power/supply/bq24190_charger.c
@@ -1982,6 +1982,8 @@  static int bq24190_get_config(struct bq24190_dev_info *bdi)
 		v = info->constant_charge_voltage_max_uv;
 		if (v >= bq24190_cvc_vreg_values[0] && v <= bdi->vreg_max)
 			bdi->vreg = bdi->vreg_max = v;
+
+		power_supply_put_battery_info(bdi->charger, info);
 	}
 
 	return 0;