[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <489609c7-3f11-4254-b5e3-6df5ec75b043@sirena.org.uk>
Date: Mon, 4 Aug 2025 13:36:43 +0100
From: Mark Brown <broonie@...nel.org>
To: Krzysztof Kozlowski <krzk@...nel.org>
Cc: Dzmitry Sankouski <dsankouski@...il.com>, Lee Jones <lee@...nel.org>,
Rob Herring <robh@...nel.org>, Conor Dooley <conor+dt@...nel.org>,
Liam Girdwood <lgirdwood@...il.com>,
André Draszik <andre.draszik@...aro.org>,
linux-kernel@...r.kernel.org, linux-samsung-soc@...r.kernel.org,
devicetree@...r.kernel.org
Subject: Re: [PATCH v7] regulator: add s2dos05 regulator support
On Sun, Aug 03, 2025 at 10:22:33AM +0200, Krzysztof Kozlowski wrote:
> On 02/08/2025 13:22, Dzmitry Sankouski wrote:
> > + for (i = 0; i < rdev_num; i++) {
> > + struct regulator_dev *regulator;
> > +
> > + regulator = devm_regulator_register(&pdev->dev,
> > + ®ulators[i], &config);
> > + if (IS_ERR(regulator)) {
> > + ret = PTR_ERR(regulator);
> > + dev_err(&pdev->dev, "regulator init failed for %d\n",
> > + i);
> > + }
> > + }
> > +
> > + return ret;
> I do not understand your logic here and I already commented on issues
> with 'ret'. If 1st regulator fails, but the last one succeeds, you
> return 0. If 1st succeeds, but the last one fails, you return failure
> failing the probe.
No, ret is assigned within the IS_ERR() check so it only records
failures - it'll take the return value from the last regulator that
failed, or otherwise return 0 if they all registered OK. It'd be as
well to just return immediately and save the bother of winding and
unwinding the later regulator setups but the error reporting should
work.
Should be a dev_err_probe() though.
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists