Re: [PATCH v3] counter: ti-eqep: use devm for runtime PM to fix probe error path

William Breathitt Gray <[email protected]> Sun, 2 Aug 2026 21:59:01 +0900
Newsgroups org.kernel.vger.linux-iio,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On Wed, Jun 03, 2026 at 08:42:32AM +0300, Andy Shevchenko wrote:
> On Fri, May 29, 2026 at 02:58:34PM +0500, Stepan Ionichev wrote:
> > ti_eqep_probe() enables runtime PM and takes a reference manually,
> > then returns directly via dev_err_probe() if devm_clk_get_enabled()
> > fails, leaking the runtime PM enable and usage count.
> 
> > v2 tried to
> > route that error through a manual cleanup label, but mixing a
> > devm-managed resource (the clock) with a manual pm_runtime unwind
> > is itself wrong: the devm clock release runs after the manual
> > unwind, in the wrong order.
> 
> It sounds like unneeded detail (because started with what v2 did, which
> is part of rather changelog or cover letter). Perhaps we may rephrase
> that in a way that "Manual cleanup via goto will mix the managed resource
> allocations and unmanaged that leads to a wrong order on the release."
> 
> Also note devm-managed is tautology since 'm' is for managed.

Stepan,

Do you have any disagreements with Andy's suggestions? I'll be happy to
merge a v4 of this patch if you rephrase the description as suggested.

Thanks,

William Breathitt Gray