From: Waqar Hameed <waqar.hameed@axis.com>
To: Linmao Li <lilinmao@kylinos.cn>
Cc: Sebastian Reichel <sre@kernel.org>, <linux-pm@vger.kernel.org>
Subject: Re: [PATCH] power: supply: bq25630: Release battery information after setup
Date: Mon, 27 Jul 2026 14:43:37 +0200 [thread overview]
Message-ID: <pndjyqgob5y.a.out@axis.com> (raw)
In-Reply-To: <20260727093738.2611185-1-lilinmao@kylinos.cn> (Linmao Li's message of "Mon, 27 Jul 2026 17:37:38 +0800")
On Mon, Jul 27, 2026 at 17:37 +0800 Linmao Li <lilinmao@kylinos.cn> wrote:
> data->batinfo is only used by bq25630_setup() to program the initial
> charge limits, but power_supply_get_battery_info() allocates it on
> psy->dev, so it stays around for the lifetime of the device. Nothing
> else in the driver uses it. Release it right after setup, as bq256xx
> and bq257xx do.
>
> Signed-off-by: Linmao Li <lilinmao@kylinos.cn>
> ---
> drivers/power/supply/bq25630_charger.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/power/supply/bq25630_charger.c b/drivers/power/supply/bq25630_charger.c
> index 165f8c67b4895..efcdb1f5bc351 100644
> --- a/drivers/power/supply/bq25630_charger.c
> +++ b/drivers/power/supply/bq25630_charger.c
> @@ -1045,10 +1045,9 @@ static int bq25630_probe(struct i2c_client *client)
> return dev_err_probe(data->dev, ret, "Could not request IRQ\n");
>
> ret = bq25630_setup(data);
> - if (ret)
> - return ret;
> + power_supply_put_battery_info(data->psy, data->batinfo);
>
> - return 0;
> + return ret;
> }
>
> static const struct of_device_id bq25630_of_match[] = {
The initial thought was that `batinfo` could/would be used elsewhere,
but as you point out, it's currently not. A better design is then to
move the `power_supply_get_battery_info()` into `bq25630_setup()`, in
order to scope the `get/put()`. So let's get `batinfo` there, just
before using it, and have an error/clean-up-path there as well.
next prev parent reply other threads:[~2026-07-27 12:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-27 9:37 [PATCH] power: supply: bq25630: Release battery information after setup Linmao Li
2026-07-27 12:43 ` Waqar Hameed [this message]
2026-07-27 20:49 ` 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=pndjyqgob5y.a.out@axis.com \
--to=waqar.hameed@axis.com \
--cc=lilinmao@kylinos.cn \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox