From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Ruoyu Wang <ruoyuw560@gmail.com>
Cc: "Linus Walleij" <linusw@kernel.org>,
"Jonathan Cameron" <jic23@kernel.org>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Lars-Peter Clausen" <lars@metafoo.de>,
"Alexandru Ardelean" <alexandru.ardelean@analog.com>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] iio: gyro: mpu3050: Fix runtime PM leak on trigger errors
Date: Tue, 18 Aug 2026 17:06:04 +0300 [thread overview]
Message-ID: <aoRmzF3_wTfyiEfU@ashevche-desk.local> (raw)
In-Reply-To: <20260818133046.858005-1-ruoyuw560@gmail.com>
On Tue, Aug 18, 2026 at 09:30:46PM +0800, Ruoyu Wang wrote:
> The first user of the MPU-3050 data-ready trigger takes a runtime PM
> reference before configuring the FIFO, sample engine and interrupt. If
> any of those operations fails, iio_trigger_attach_poll_func() tears down
> its IRQ resources without calling set_trigger_state(false). The buffer
> error path then releases only its preenable reference, leaving the
> trigger's reference held and preventing runtime suspend.
>
> Use PM_RUNTIME_ACQUIRE_IF_ENABLED_AUTOSUSPEND() so a failed resume does
> not leave a usage count behind and later setup failures automatically
> release the acquired reference. Disarm the scoped cleanup after the
> interrupt has been enabled, leaving the disable path to release the
> trigger's reference. Keep hw_irq_trigger clear unless interrupt setup
> succeeds.
>
> This issue was found by a static analysis checker and confirmed by manual
> source review.
...
> Suggested-by: Andy Shevchenko <andriy.shevchenko@intel.com>
I'm not sure I suggested the solution as targeted by this patch.
...
> + retain_and_null_ptr(pm);
Ah, I see, in such a case it might be better to leave the bare runtime PM
calls. Sorry for the suboptimal proposal.
--
With Best Regards,
Andy Shevchenko
prev parent reply other threads:[~2026-08-18 14:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-18 13:30 Ruoyu Wang
2026-08-18 14:06 ` Andy Shevchenko [this message]
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=aoRmzF3_wTfyiEfU@ashevche-desk.local \
--to=andriy.shevchenko@intel.com \
--cc=alexandru.ardelean@analog.com \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linusw@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=ruoyuw560@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
all inboxes | Powered by JetHome®