* [PATCH] regulator: fp9931: Fix error handling for optional regulator
@ 2026-03-12 4:01 Robby Cai
2026-03-12 17:34 ` Mark Brown
2026-03-12 17:58 ` Andreas Kemnade
0 siblings, 2 replies; 6+ messages in thread
From: Robby Cai @ 2026-03-12 4:01 UTC (permalink / raw)
To: lgirdwood, broonie, andreas; +Cc: imx, linux-kernel, robby.cai
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@nxp.com>
---
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");
- if (IS_ERR(data->vin_reg))
- return dev_err_probe(&client->dev, PTR_ERR(data->vin_reg),
- "failed to get vin regulator\n");
+ if (IS_ERR(data->vin_reg)) {
+ if (PTR_ERR(data->vin_reg) != -ENODEV)
+ return dev_err_probe(&client->dev, PTR_ERR(data->vin_reg),
+ "failed to get vin regulator\n");
+
+ data->vin_reg = NULL;
+ }
data->pgood_gpio = devm_gpiod_get(&client->dev, "pg", GPIOD_IN);
if (IS_ERR(data->pgood_gpio))
--
2.37.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH] regulator: fp9931: Fix error handling for optional regulator
2026-03-12 4:01 [PATCH] regulator: fp9931: Fix error handling for optional regulator Robby Cai
@ 2026-03-12 17:34 ` Mark Brown
2026-03-12 17:58 ` Andreas Kemnade
1 sibling, 0 replies; 6+ messages in thread
From: Mark Brown @ 2026-03-12 17:34 UTC (permalink / raw)
To: lgirdwood, andreas, Robby Cai; +Cc: imx, linux-kernel
On Thu, 12 Mar 2026 12:01:48 +0800, Robby Cai 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.
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next
Thanks!
[1/1] regulator: fp9931: Fix error handling for optional regulator
commit: 8066a5855ed986f822df4d8b1fa8017b88a43e76
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] regulator: fp9931: Fix error handling for optional regulator
2026-03-12 4:01 [PATCH] regulator: fp9931: Fix error handling for optional regulator Robby Cai
2026-03-12 17:34 ` Mark Brown
@ 2026-03-12 17:58 ` Andreas Kemnade
2026-03-12 18:00 ` Mark Brown
2026-03-13 0:24 ` Robby Cai
1 sibling, 2 replies; 6+ messages in thread
From: Andreas Kemnade @ 2026-03-12 17:58 UTC (permalink / raw)
To: Robby Cai; +Cc: lgirdwood, broonie, imx, linux-kernel
On Thu, 12 Mar 2026 12:01:48 +0800
Robby Cai <robby.cai@nxp.com> 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@nxp.com>
> ---
> 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
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] regulator: fp9931: Fix error handling for optional regulator
2026-03-12 17:58 ` Andreas Kemnade
@ 2026-03-12 18:00 ` Mark Brown
2026-03-13 0:27 ` Robby Cai
2026-03-13 0:24 ` Robby Cai
1 sibling, 1 reply; 6+ messages in thread
From: Mark Brown @ 2026-03-12 18:00 UTC (permalink / raw)
To: Andreas Kemnade; +Cc: Robby Cai, lgirdwood, imx, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 556 bytes --]
On Thu, Mar 12, 2026 at 06:58:54PM +0100, Andreas Kemnade wrote:
> Robby Cai <robby.cai@nxp.com> wrote:
> > 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.
If it's a mandatory supply that's right, I may have misunderstood what
the supply was doing when I originally reviewed this.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] regulator: fp9931: Fix error handling for optional regulator
2026-03-12 18:00 ` Mark Brown
@ 2026-03-13 0:27 ` Robby Cai
0 siblings, 0 replies; 6+ messages in thread
From: Robby Cai @ 2026-03-13 0:27 UTC (permalink / raw)
To: Mark Brown; +Cc: Andreas Kemnade, lgirdwood, imx, linux-kernel
On Thu, Mar 12, 2026 at 06:00:54PM +0000, Mark Brown wrote:
> On Thu, Mar 12, 2026 at 06:58:54PM +0100, Andreas Kemnade wrote:
> > Robby Cai <robby.cai@nxp.com> wrote:
>
> > > 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.
>
> If it's a mandatory supply that's right, I may have misunderstood what
> the supply was doing when I originally reviewed this.
Thanks for the review. This does make sense. I'll send out patch v2 soon.
Regards,
Robby
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] regulator: fp9931: Fix error handling for optional regulator
2026-03-12 17:58 ` Andreas Kemnade
2026-03-12 18:00 ` Mark Brown
@ 2026-03-13 0:24 ` Robby Cai
1 sibling, 0 replies; 6+ messages in thread
From: Robby Cai @ 2026-03-13 0:24 UTC (permalink / raw)
To: Andreas Kemnade; +Cc: lgirdwood, broonie, imx, linux-kernel
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@nxp.com> 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@nxp.com>
> > ---
> > 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
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-03-13 0:25 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-12 4:01 [PATCH] regulator: fp9931: Fix error handling for optional regulator Robby Cai
2026-03-12 17:34 ` Mark Brown
2026-03-12 17:58 ` Andreas Kemnade
2026-03-12 18:00 ` Mark Brown
2026-03-13 0:27 ` Robby Cai
2026-03-13 0:24 ` Robby Cai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox