Re: [PATCH v4 2/2] iio: gyro: mpu3050: Fix runtime PM refcount leak in trigger enable path

From: Xiangwu Lai

Date: Thu Nov 05 2026 - 03:22:06 EST


Hi Andy,

Thanks for the suggestion!

The runtime PM reference in mpu3050_drdy_trigger_enable() is not
scoped to the function: it is taken when the trigger is enabled and
only dropped by mpu3050_drdy_trigger_disable() via
pm_runtime_put_autosuspend() when the trigger is turned off again.
The buffer preenable/postdisable pair in this driver manages its
reference the same way for the buffer lifetime.

With a scoped guard the reference would be released as soon as
mpu3050_drdy_trigger_enable() returns, so the device could runtime
suspend while the data ready trigger is still armed, and the usage
counter would underflow when the disable path drops a reference
that the guard had already released.

So an acquire-here / release-elsewhere lifetime like this does not
seem to be expressible with the ACQUIRE() family. If you see a
formulation that fits, I'm happy to rework the patch onto it.

Best regards,
Xiangwu Lai