Skip to content

Commit f444578

Browse files
Linus Walleijsre
authored andcommitted
power: supply: bq256xx: Handle OOM correctly
Since we now return a pointer to an allocated object we need to account for memory allocation failure in a separate error path. Fixes: 25fd330 ("power: supply_core: Pass pointer to battery info") Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
1 parent 2b56a9a commit f444578

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/power/supply/bq256xx_charger.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1523,6 +1523,9 @@ static int bq256xx_hw_init(struct bq256xx_device *bq)
15231523
BQ256XX_WDT_BIT_SHIFT);
15241524

15251525
ret = power_supply_get_battery_info(bq->charger, &bat_info);
1526+
if (ret == -ENOMEM)
1527+
return ret;
1528+
15261529
if (ret) {
15271530
dev_warn(bq->dev, "battery info missing, default values will be applied\n");
15281531

0 commit comments

Comments
 (0)