From: William Breathitt Gray <wbg@kernel.org>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: William Breathitt Gray <wbg@kernel.org>,
Stepan Ionichev <sozdayvek@gmail.com>,
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 v2] counter: ti-eqep: balance pm_runtime on devm_clk_get_enabled() failure
Date: Wed, 27 May 2026 17:18:29 +0900 [thread overview]
Message-ID: <20260527081833.505655-1-wbg@kernel.org> (raw)
In-Reply-To: <CAHp75VecaMW5S+jtP5ZMr2ZtPTHXsTeVzos7+WSpgnj7YcMjLg@mail.gmail.com>
On Wed, May 27, 2026 at 10:10:20AM +0200, Andy Shevchenko wrote:
> On Mon, May 25, 2026 at 5:21 PM Stepan Ionichev <sozdayvek@gmail.com> wrote:
> >
> > ti_eqep_probe() calls pm_runtime_enable() and pm_runtime_get_sync()
> > before devm_clk_get_enabled(). If the clk call fails, the function
> > returns directly via dev_err_probe(), leaving runtime PM enabled
> > and the usage counter incremented.
> >
> > Route the clk error through the same err_pm cleanup as counter_add()
> > so the runtime PM state is unwound on every failure path.
>
> ...
>
> > pm_runtime_get_sync(dev);
> >
> > clk = devm_clk_get_enabled(dev, NULL);
> > - if (IS_ERR(clk))
> > - return dev_err_probe(dev, PTR_ERR(clk), "failed to enable clock\n");
> > + if (IS_ERR(clk)) {
> > + err = dev_err_probe(dev, PTR_ERR(clk), "failed to enable clock\n");
> > + goto err_pm;
>
> This is not right. The devm_*() should not be followed by goto.
>
> > + }
>
> ...
>
> > +err_pm:
> > + pm_runtime_put_sync(dev);
> > + pm_runtime_disable(dev);
> > + return err;
>
> You have to use the respective devm_pm_*() at the same time.
>
> ...
>
> William, this patch should not be applied (or should be reverted) as
> in current form it replaces one issue by another.
>
> --
> With Best Regards,
> Andy Shevchenko
I'll revert for now. Would the proper fix be to replace all
pm_runtime_*() with their respective devm_pm_*() calls?
William Breathitt Gray
next prev parent reply other threads:[~2026-05-27 8:18 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-25 15:21 [PATCH v2] counter: ti-eqep: balance pm_runtime on devm_clk_get_enabled() failure Stepan Ionichev
2026-05-26 10:32 ` Joshua Crofts
2026-05-27 7:12 ` William Breathitt Gray
2026-05-27 8:10 ` Andy Shevchenko
2026-05-27 8:18 ` William Breathitt Gray [this message]
2026-05-27 8:29 ` Andy Shevchenko
2026-05-29 9:57 ` Stepan Ionichev
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=20260527081833.505655-1-wbg@kernel.org \
--to=wbg@kernel.org \
--cc=andy.shevchenko@gmail.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 \
/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