mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Stepan Ionichev <sozdayvek@gmail.com>
Cc: wbg@kernel.org, m32285159@gmail.com, dlechner@baylibre.com,
	nuno.sa@analog.com, andy@kernel.org, linux-iio@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] counter: ti-eqep: use devm for runtime PM to fix probe error path
Date: Wed, 3 Jun 2026 08:42:32 +0300	[thread overview]
Message-ID: <ah--yK0SXW4TC2xC@ashevche-desk.local> (raw)
In-Reply-To: <20260529095834.2561-1-sozdayvek@gmail.com>

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.

> Manage the runtime PM with devm instead: devm_pm_runtime_enable()
> for the enable, pm_runtime_resume_and_get() with a devm action for
> the get/put. Every probe error path then unwinds through devm in
> the correct reverse order, and ti_eqep_remove() no longer has to
> touch runtime PM.

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2026-06-03  5:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-29  9:58 Stepan Ionichev
2026-06-03  5:42 ` Andy Shevchenko [this message]
2026-08-02 12:59   ` William Breathitt Gray
2026-11-02 10:00     ` [PATCH v3] counter: ti-eqep: use devm for runtime PM to phucduc.bui
2026-11-06 19:32       ` William Breathitt Gray
2026-11-09  7:21         ` Bui Duc Phuc
2026-06-04  2:19 ` [PATCH v3] counter: ti-eqep: use devm for runtime PM to fix probe error path William Breathitt Gray

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ah--yK0SXW4TC2xC@ashevche-desk.local \
    --to=andriy.shevchenko@intel.com \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m32285159@gmail.com \
    --cc=nuno.sa@analog.com \
    --cc=sozdayvek@gmail.com \
    --cc=wbg@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®