From: Hans de Goede <hansg@kernel.org>
To: Sebastian Reichel <sre@kernel.org>
Cc: Hans de Goede <hansg@kernel.org>, Mark Brown <broonie@kernel.org>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
Linus Walleij <linus.walleij@linaro.org>,
linux-pm@vger.kernel.org
Subject: [PATCH 10/10] power: supply: bq24190: Free battery_info
Date: Sun, 8 Jun 2025 22:40:10 +0200 [thread overview]
Message-ID: <20250608204010.37482-11-hansg@kernel.org> (raw)
In-Reply-To: <20250608204010.37482-1-hansg@kernel.org>
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 --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;
--
2.49.0
next prev parent reply other threads:[~2025-06-08 20:40 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-08 20:40 [PATCH 00/10] power: supply: ug3105_battery: Switch to power_supply_batinfo_ocv2cap() Hans de Goede
2025-06-08 20:40 ` [PATCH 01/10] regulator: act8865-regulator: switch psy_cfg from of_node to fwnode Hans de Goede
2025-06-08 20:40 ` [PATCH 02/10] power: supply: core: remove of_node from power_supply_config Hans de Goede
2025-06-08 20:40 ` [PATCH 03/10] power: supply: core: battery-info: fully switch to fwnode Hans de Goede
2025-06-08 20:40 ` [PATCH 04/10] fixup! " Hans de Goede
2025-06-08 20:40 ` [PATCH 05/10] " Hans de Goede
2025-06-08 20:40 ` [PATCH 06/10] power: supply: core: convert to fwnnode Hans de Goede
2025-06-08 20:40 ` [PATCH 07/10] power: supply: core: rename power_supply_get_by_phandle to power_supply_get_by_reference Hans de Goede
2025-06-08 20:40 ` [PATCH 08/10] power: supply: ug3105_battery: Use psy->battery_info Hans de Goede
2025-06-08 20:40 ` [PATCH 09/10] power: supply: ug3105_battery: Switch to power_supply_batinfo_ocv2cap() Hans de Goede
2025-06-08 20:40 ` Hans de Goede [this message]
2025-06-22 0:10 ` (subset) [PATCH 00/10] " Sebastian Reichel
2025-06-22 1:09 ` Sebastian Reichel
2025-06-26 23:31 ` Mark Brown
2025-07-06 23:36 ` Sebastian Reichel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250608204010.37482-11-hansg@kernel.org \
--to=hansg@kernel.org \
--cc=angelogioacchino.delregno@collabora.com \
--cc=broonie@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-pm@vger.kernel.org \
--cc=sre@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.