Re: [PATCH] power: supply: max77759: initialize registration, configurations

From: Amit Sunil Dhamne

Date: Fri Nov 13 2026 - 19:26:27 EST


On 11/9/26 3:14 PM, Christian Loehle wrote:
> Booting a Pixel 6 with CONFIG_INIT_STACK_NONE can oops in
> internal_create_group() while probing the MAX77759 charger. The probe
> only initializes fwnode and drv_data in its automatic power_supply_config.
> The power-supply core copies the uninitialized attr_grp into dev->groups,
> allowing sysfs to follow an invalid attribute-group pointer.
> The local regulator_config is also only partly initialized. Its unused
> init_data, regmap and ena_gpiod fields can be consumed by regulator core.
> Parsing the device tree does not initialize all of these fields.
>
> Zero-initialize them both configurations before used fields are
> assigned.
>
> Fixes: 70d7dd27f6dc ("power: supply: max77759: add charger driver")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Christian Loehle <christian.loehle@xxxxxxx>
Reviewed-by: Amit Sunil Dhamne <amitsd@xxxxxxxxxx>

> ---
> drivers/power/supply/max77759_charger.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/power/supply/max77759_charger.c b/drivers/power/supply/max77759_charger.c
> index a93adb266f01..e792327ff14f 100644
> --- a/drivers/power/supply/max77759_charger.c
> +++ b/drivers/power/supply/max77759_charger.c
> @@ -683,8 +683,8 @@ static void max_tcpci_unregister_psy_notifier(void *nb)
>
> static int max77759_charger_probe(struct platform_device *pdev)
> {
> - struct regulator_config chgin_otg_reg_cfg;
> - struct power_supply_config psy_cfg;
> + struct regulator_config chgin_otg_reg_cfg = {};
> + struct power_supply_config psy_cfg = {};
> struct device *dev = &pdev->dev;
> struct max77759_charger *chg;
> int ret;