[PATCH] mtd: intel-dg: wake card on operations
Andy Shevchenko
andriy.shevchenko at linux.intel.com
Tue Oct 21 07:39:34 PDT 2025
On Tue, Oct 21, 2025 at 12:51:30PM +0000, Usyskin, Alexander wrote:
> > On Mon, Oct 20, 2025 at 01:09:10PM +0300, Andy Shevchenko wrote:
> > > On Sun, Oct 19, 2025 at 06:01:45PM +0300, Alexander Usyskin wrote:
...
> > > > + devm_pm_runtime_enable(device);
> > >
> > > Please, justify why this code is good without error checking. Before doing
> > that
> > > think for a moment for the cases when devm_*() might be developed in the
> > future
> > > and return something interesting (if not yet).
>
> We should not fail the probe because of runtime pm enablement failure, I suppose.
> There are other ways to keep card awake.
> The pm_runtime_* functions work without runtime_enable but have no effect.
> Thus, we can ignore failure here.
Using devm_*() in such a case is misleading. It incorporates errors from
different layers and ignoring both is odd.
I would suggest to avoid using devm_*() in this case and put a comment on
the ignored PM errors (however, personally I think this approach is wrong).
...
> > > > err:
> > > > + pm_runtime_put(device);
> > > > +err_norpm:
> > > > kref_put(&nvm->refcnt, intel_dg_nvm_release);
> > > > return ret;
> > >
> > > Mixing devm with non-devm usually lead to hard to catch bugs in the error
> > paths
> > > / remove stages with ordering of cleaning resources up.
>
> I see that this pattern is reasonably common in drivers.
> There can't be devm wrappers for pm_runtime_get/put and these functions works
> regardless of enable status.
It can be wrapped to become a managed resource, but the problem is that you are
ignoring errors from it, which I consider a bit incorrect.
--
With Best Regards,
Andy Shevchenko
More information about the linux-mtd
mailing list