Re: [PATCH v4 1/2] counter: ti-eqep: Fix runtime PM leak on probe failure
From: David Lechner
Date: Tue Nov 10 2026 - 09:45:21 EST
On 11/9/26 5:23 PM, Andy Shevchenko wrote:
> On Mon, Nov 09, 2026 at 03:43:41PM +0700, phucduc.bui@xxxxxxxxx wrote:
>
>> ti_eqep_probe() enables runtime PM and takes a usage reference manually,
>> then returns directly via dev_err_probe() if devm_clk_get_enabled()
>> fails, leaking both.
>>
>> Manual cleanup via goto would mix managed and unmanaged resources,
>> which leads to the wrong release order. Instead, use
>> devm_pm_runtime_enable() and pm_runtime_resume_and_get() with a devm
>> action for the put, so every probe error path unwinds in the correct
>> reverse order. As a side effect, a runtime resume failure now aborts
>> the probe instead of being ignored.
>>
>> ti_eqep_remove() no longer needs to touch runtime PM. While at it,
>> report counter_add() failures with dev_err_probe().
>
> I'm confused. Why the PM runtime is used (and announced) in this driver at all?
> Do we have upper layer (like a bus driver) disable power before handing over to
> the device driver?
Your guess is right. There is a parent bus shared by eQEP, ECAP and EHRPWM
that has to be turned on so that any of them can work.
>
> TL;DR: what's the point in runtime PM here?
>