pm_runtime_get_sync() increments the usage counter even on failure, so every successful call must be paired with a put. A failure of gp2ap002_get_lux() returned early and skipped the paired pm_runtime_put_autosuspend(), permanently preventing runtime suspend. Jump to the common exit that releases the reference. Fixes: f6dbf83c17cb ("iio: light: gp2ap002: Take runtime PM reference on light read") Cc: stable@vger.kernel.org Signed-off-by: Wentao Liang --- drivers/iio/light/gp2ap002.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/light/gp2ap002.c b/drivers/iio/light/gp2ap002.c index a0d8a58f2704..886accf5e859 100644 --- a/drivers/iio/light/gp2ap002.c +++ b/drivers/iio/light/gp2ap002.c @@ -258,7 +258,7 @@ static int gp2ap002_read_raw(struct iio_dev *indio_dev, case IIO_LIGHT: ret = gp2ap002_get_lux(gp2ap002); if (ret < 0) - return ret; + goto out; *val = ret; ret = IIO_VAL_INT; goto out; -- 2.34.1