Re: [PATCH] mtd: intel-dg: wake card on operations

Andy Shevchenko
2025-10-20T10:09:15Z

On Sun, Oct 19, 2025 at 06:01:45PM +0300, Alexander Usyskin wrote:
> Enable runtime PM in mtd driver to notify parent graphics driver
> that whole card should be kept awake while nvm operations are
> performed through this driver.

...

> + pm_runtime_mark_last_busy(nvm->dev);
> + pm_runtime_put_autosuspend(nvm->dev);

Please, drop the second (duplicate) call.

...

> + 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).

...

> 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.

--
With Best Regards,
Andy Shevchenko