Re: [PATCH v2 4/6] iio: accel: mma8452: Use dev_err_probe()

From: Jonathan Cameron

Date: Fri Apr 24 2026 - 13:34:38 EST


On Fri, 24 Apr 2026 18:19:19 +0100
Jonathan Cameron <jic23@xxxxxxxxxx> wrote:

> On Wed, 22 Apr 2026 22:37:32 +0300
> Andy Shevchenko <andriy.shevchenko@xxxxxxxxx> wrote:
>
> > On Wed, Apr 22, 2026 at 10:26:41PM +0530, Sanjay Chitroda wrote:
> >
> > > dev_err_probe() makes error code handling simpler and handle
> > > deferred probe nicely (avoid spamming logs).
> >
> > This patch should go earlier than dev temporary variable one.
> > And dev needs to be introduced here.
> >
> > ...
> >
> > > ret = regulator_enable(data->vddio_reg);
> > > if (ret) {
> > > - dev_err(dev, "failed to enable VDDIO regulator!\n");
> > > + dev_err_probe(dev, ret, "failed to enable VDDIO regulator!\n");
> > > goto disable_regulator_vdd;
> >
> > Before doing these patches, please fix the mess with the devm/non-devm ordering.
> > There shouldn't be goto after any devm calls.
> >
> I briefly wondered what you meant here. Key is you are referring to
> devm_request_threaded_irq() much further down.
>
> Absolutely agree that's wrong. Rule is devm until you stop doing devm and
> then no more devm.
>
> Here it looks like we can take the whole thing devm but it will need
> some custom callbacks and we may run into corner cases with runtime_pm()
> messing with the supplies and devm cleanup doing so (that applies even
> without devm being involved)

Just noticed the two regulators are always controlled together.
Can probably simplify code by using bulk operators.
e.g. regulator_bulk_enable() / disable() etc.


>
> Jonathan
>
>
>
> > > }
> >
>
>