Skip to content

Commit 6276cec

Browse files
author
Al Stone
committed
power: supply: bq256xx: Handle OOM correctly
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2071846 Tested: This is one of a series of patch sets to enable Arm SystemReady IR support in the kernel for NXP i.MX8 platforms. This set updates the power subsystem. This set has been tested via simple boot tests and the CI loop. commit f444578 Author: Linus Walleij <linus.walleij@linaro.org> Date: Mon Jan 10 16:50:07 2022 +0100 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> (cherry picked from commit f444578) Signed-off-by: Al Stone <ahs3@redhat.com>
1 parent 979e617 commit 6276cec

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

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)