Re: [PATCH] iio: gyro: mpu3050: Fix runtime PM leak on trigger errors

Jonathan Cameron <[email protected]>
Newsgroups gmane.linux.kernel.iio,gmane.linux.kernel
Message-ID <20260822231745.18219605@jic23-huawei>
On Mon, 17 Aug 2026 10:29:24 +0300
Andy Shevchenko <[email protected]> wrote:

> On Fri, Aug 14, 2026 at 09:41:11PM +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_resume_and_get() so a resume failure does not leave a
> > usage count behind. Route later setup failures through a common unwind
> > that clears hw_irq_trigger and drops the trigger's reference. Successful
> > enable and disable behavior is unchanged.
> > 
> > This issue was found by a static analysis checker and confirmed by
> > manual source review.  
> 
> Why not using the respective PM_RUNTIME_ACQUIRE*() macros?
> 

That is only applicable in one location.  Nice to have though but
will need combining with a guard(mutex)();
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.