Skip to content

Commit 02bf586

Browse files
author
Al Stone
committed
power: supply: core: Initialize struct to zero
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 e56a4be Author: Linus Walleij <linus.walleij@linaro.org> Date: Mon Apr 25 00:13:01 2022 +0200 power: supply: core: Initialize struct to zero As we rely on pointers in the battery info to be zero-initialized such as in the helper function power_supply_supports_vbat2ri() we certainly need to allocate the struct power_supply_battery_info with kzalloc() as well. Else this happens: Unable to handle kernel paging request at virtual address 00280000 (...) PC is at power_supply_vbat2ri+0x50/0x12c LR is at ab8500_fg_battery_resistance+0x34/0x108 Fixes: e9e7d16 ("power: supply: Support VBAT-to-Ri lookup tables") Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com> (cherry picked from commit e56a4be) Signed-off-by: Al Stone <ahs3@redhat.com>
1 parent e4c7664 commit 02bf586

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/power/supply/power_supply_core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ int power_supply_get_battery_info(struct power_supply *psy,
616616
goto out_put_node;
617617
}
618618

619-
info = devm_kmalloc(&psy->dev, sizeof(*info), GFP_KERNEL);
619+
info = devm_kzalloc(&psy->dev, sizeof(*info), GFP_KERNEL);
620620
if (!info) {
621621
err = -ENOMEM;
622622
goto out_put_node;

0 commit comments

Comments
 (0)