mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Lechner <david@lechnology.com>
To: Andy Shevchenko <andriy.shevchenko@intel.com>, phucduc.bui@gmail.com
Cc: wbg@kernel.org, andy@kernel.org, dlechner@baylibre.com,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	m32285159@gmail.com, nuno.sa@analog.com, sozdayvek@gmail.com
Subject: Re: [PATCH v4 1/2] counter: ti-eqep: Fix runtime PM leak on probe failure
Date: Tue, 10 Nov 2026 08:39:56 -0600	[thread overview]
Message-ID: <75f2bbfe-23e8-4455-b042-3570c123832a@lechnology.com> (raw)
In-Reply-To: <avJV68gHL_jvZ6dZ@ashevche-desk.local>

On 11/9/26 5:23 PM, Andy Shevchenko wrote:
> On Mon, Nov 09, 2026 at 03:43:41PM +0700, phucduc.bui@gmail.com 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?
> 


  parent reply	other threads:[~2026-11-10 14:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-09  8:43 [PATCH v4 0/2] counter: ti-eqep: Fix runtime PM leak and use devm_counter_add() phucduc.bui
2026-11-09  8:43 ` [PATCH v4 1/2] counter: ti-eqep: Fix runtime PM leak on probe failure phucduc.bui
2026-11-09 23:23   ` Andy Shevchenko
2026-11-10 11:01     ` Bui Duc Phuc
2026-11-10 14:39     ` David Lechner [this message]
2026-11-09  8:43 ` [PATCH v4 2/2] counter: ti-eqep: Use devm_counter_add() phucduc.bui

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=75f2bbfe-23e8-4455-b042-3570c123832a@lechnology.com \
    --to=david@lechnology.com \
    --cc=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=phucduc.bui@gmail.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®