Re: [PATCH] regulator: fp9931: Fix error handling for optional regulator
From: Robby Cai
Date: Thu Mar 12 2026 - 20:24:14 EST
On Thu, Mar 12, 2026 at 06:58:54PM +0100, Andreas Kemnade wrote:
> On Thu, 12 Mar 2026 12:01:48 +0800
> Robby Cai <robby.cai@xxxxxxx> wrote:
>
> > If "vin" reg does not exist in the device tree, the regulator framework
> > returns -ENODEV, which is normal for an optional supply. But the current
> > code treats -ENODEV as a fatal error, causing the driver probe to fail.
> > This patch fixes that by handling -ENODEV correctly for optional regulator.
> >
> > Fixes: 12d821bd13d4 ("regulator: Add FP9931/JD9930 driver")
> > Signed-off-by: Robby Cai <robby.cai@xxxxxxx>
> > ---
> > drivers/regulator/fp9931.c | 10 +++++++---
> > 1 file changed, 7 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/regulator/fp9931.c b/drivers/regulator/fp9931.c
> > index 7fbcc6327cc63..fa7f32adfb666 100644
> > --- a/drivers/regulator/fp9931.c
> > +++ b/drivers/regulator/fp9931.c
> > @@ -448,9 +448,13 @@ static int fp9931_probe(struct i2c_client *client)
> > "failed to allocate regmap!\n");
> >
> > data->vin_reg = devm_regulator_get_optional(&client->dev, "vin");
>
> looking at that thing again. I think I have abused the optional api.
> Of course this chip needs a supply. It may be hardwired so something
> not switchable. But that needs to be wired to something... So I think
> rather the _optional is wrong here.
>
> Regards,
> Andreas
Thanks for the review. That's right. I'll send out new patch for review.
Regards,
Robby