]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
power: supply: bq24190: Free battery_info
authorHans de Goede <hansg@kernel.org>
Sun, 8 Jun 2025 20:40:10 +0000 (22:40 +0200)
committerSebastian Reichel <sebastian.reichel@collabora.com>
Sun, 22 Jun 2025 00:08:44 +0000 (02:08 +0200)
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>
Link: https://lore.kernel.org/r/20250608204010.37482-11-hansg@kernel.org
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
drivers/power/supply/bq24190_charger.c

index 1867beadd7afff8273d6fc7770b470209e4845e2..2c3804e1207e5d1d3000cfd6452acb06ec340cc0 100644 (file)
@@ -1983,6 +1983,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;