[PATCH] power: supply: bq25630: Release battery information after setup
Linmao Li <[email protected]>
| Newsgroups | org.kernel.vger.linux-pm |
|---|---|
| Message-ID | <[email protected]> |
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 <[email protected]> --- 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[] = { -- 2.25.1