[PATCH v6 09/13] gpio: mxc: use cleanup guard for pm_runtime_get_noresume() balance
Peng Fan
peng.fan at oss.nxp.com
Mon Oct 12 03:10:52 PDT 2026
On Mon, Oct 12, 2026 at 12:38:37PM +0300, Andy Shevchenko wrote:
>On Sun, Oct 11, 2026 at 2:54 PM Peng Fan (OSS) <peng.fan at oss.nxp.com> wrote:
>>
>> pm_runtime_get_noresume() in probe must be balanced by
>> pm_runtime_put_noidle() on error paths, or pm_runtime_put_autosuspend()
>> on success. devm_pm_runtime_get_noresume() cannot be used here because
>> its devres action (pm_runtime_put_noidle()) would fire on unbind in
>> addition to the success-path pm_runtime_put_autosuspend(), causing a
>> usage counter underflow.
>>
>> Use a __free guard to automatically call pm_runtime_put_noidle() on
>> error paths, and disarm it with no_free_ptr() before the success-path
>> pm_runtime_put_autosuspend().
>
>...
>
>> +DEFINE_FREE(pm_runtime_put_noidle, struct device *, if (_T) pm_runtime_put_noidle(_T))
>
>Please, split this to a separate patch and move it directly to pm_runtime.h.
Frank raised same suggestion in V5.
I tend to avoid introducing cross-subsystem dependency and use a follow-up
patch to move it to pm_runtime.h
But since you both vote for pm_runtime.h, let me separate it in V7.
Thanks
Peng
>
>--
>With Best Regards,
>Andy Shevchenko
>
>
More information about the linux-arm-kernel
mailing list