Re: [PATCH 2/4] iio: light: stk3310: Implement vdd supply and power it off during suspend
From: Andy Shevchenko
Date: Thu Apr 18 2024 - 11:57:00 EST
On Thu, Apr 18, 2024 at 6:06 PM Aren <aren@xxxxxxxxxxxxxxxxx> wrote:
> On Mon, Apr 15, 2024 at 05:04:53PM +0300, Andy Shevchenko wrote:
> > On Sun, Apr 14, 2024 at 8:57 PM Aren Moynihan <aren@xxxxxxxxxxxxxxxxx> wrote:
..
> > > stk3310_set_state(iio_priv(indio_dev), STK3310_STATE_STANDBY);
> > > + if (data->vdd_reg)
> > > + regulator_disable(data->vdd_reg);
> >
> > I forgot to check the order of freeing resources, be sure you have no
> > devm_*() releases happening before this call.
>
> If I understand what you're saying, this should be fine. The driver just
> uses devm to clean up acquired resources after remove is called. Or am I
> missing something and resources could be freed before calling
> stk3310_remove?
I'm not objecting to that. The point here is that the resources should
be freed in the reversed order. devm-allocated resources are deferred
to be freed after the explicit driver ->remove() callback. At the end
it should not interleave with each other, i.o.w. it should be
probe: devm followed by non-devm
remove: non-devm only.
--
With Best Regards,
Andy Shevchenko