Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: 25fd330370ac ("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>

authored by

Linus Walleij and committed by
Sebastian Reichel
f444578d 2b56a9a2

+3
+3
drivers/power/supply/bq256xx_charger.c
··· 1523 1523 BQ256XX_WDT_BIT_SHIFT); 1524 1524 1525 1525 ret = power_supply_get_battery_info(bq->charger, &bat_info); 1526 + if (ret == -ENOMEM) 1527 + return ret; 1528 + 1526 1529 if (ret) { 1527 1530 dev_warn(bq->dev, "battery info missing, default values will be applied\n"); 1528 1531