iio: pressure: mpl115: Fix runtime PM leak in mpl115_read_raw()
Subsystems (2)
PATCH 1/1 iio: pressure: mpl115: Fix runtime PM leak in mpl115_read_raw()
pm_runtime_get_sync() increments the usage counter even on failure, so every successful call must be paired with a put. Both sensor read failures returned early and skipped the paired pm_runtime_put_autosuspend(), permanently preventing runtime suspend.
Fixes 0c3a333524a3 ("iio: pressure: mpl115: Implementing low power mode by shutdown gpio")
Signed-off-by Wentao Liang <[email protected]>
--- drivers/iio/pressure/mpl115.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/iio/pressure/mpl115.c +6 -2
@@ -106,8 +106,10 @@ static int mpl115_read_raw(struct iio_dev *indio_dev,case IIO_CHAN_INFO_PROCESSED :pm_runtime_get_sync (data->dev); ret =mpl115_comp_pressure (data, val, val2); -if (ret <0 ) +if (ret <0 ) { +pm_runtime_put_autosuspend (data->dev);return ret; + }pm_runtime_put_autosuspend (data->dev);return IIO_VAL_INT_PLUS_MICRO ;
@@ -115,8 +117,10 @@ static int mpl115_read_raw(struct iio_dev *indio_dev,pm_runtime_get_sync (data->dev);/* temperature -5.35 C / LSB, 472 LSB is 25 C */ ret =mpl115_read_temp (data); -if (ret <0 ) +if (ret <0 ) { +pm_runtime_put_autosuspend (data->dev);return ret; + }pm_runtime_put_autosuspend (data->dev); *val = ret >>6 ;
Signature · 1 line
2.34.1
Jonathan Cameron
maintainerQuoted 8 lines · On Wed, 16 Sep 2026 16:38:52 +0000 Wentao Liang <[email protected]> wrote:
pm_runtime_get_sync()increments the usage counter even on failure, so every successful call must be paired with a put. Both sensor read failures returned early and skipped the pairedpm_runtime_put_autosuspend(), permanently preventing runtime suspend.Fixes 0c3a333524a3 ("iio: pressure: mpl115: Implementing low power mode by shutdown gpio")Signed-off-by Wentao Liang <[email protected]>
see upstream...
Quoted 32 lines
--- drivers/iio/pressure/mpl115.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)drivers/iio/pressure/mpl115.c +6
-2@@ -106,8 +106,10 @@ static int mpl115_read_raw(struct iio_dev *indio_dev,case IIO_CHAN_INFO_PROCESSED :pm_runtime_get_sync (data->dev); ret =mpl115_comp_pressure (data, val, val2); -if (ret <0 ) +if (ret <0 ) { +pm_runtime_put_autosuspend (data->dev);return ret; + }pm_runtime_put_autosuspend (data->dev);return IIO_VAL_INT_PLUS_MICRO ;@@ -115,8 +117,10 @@ static int mpl115_read_raw(struct iio_dev *indio_dev,pm_runtime_get_sync (data->dev);/* temperature -5.35 C / LSB, 472 LSB is 25 C */ ret =mpl115_read_temp (data); -if (ret <0 ) +if (ret <0 ) { +pm_runtime_put_autosuspend (data->dev);return ret; + }pm_runtime_put_autosuspend (data->dev); *val = ret >>6 ;