[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260130113041.50978-1-antoniu.miclaus@analog.com>
Date: Fri, 30 Jan 2026 13:30:20 +0200
From: Antoniu Miclaus <antoniu.miclaus@...log.com>
To: Jonathan Cameron <jic23@...nel.org>,
David Lechner
<dlechner@...libre.com>,
Nuno Sá <nuno.sa@...log.com>,
Andy Shevchenko <andy@...nel.org>,
Antoniu Miclaus
<antoniu.miclaus@...log.com>,
Linus Walleij <linus.walleij@...aro.org>,
Sakari Ailus <sakari.ailus@...ux.intel.com>,
Ulf Hansson
<ulf.hansson@...aro.org>, <linux-iio@...r.kernel.org>,
<linux-kernel@...r.kernel.org>
Subject: [PATCH] iio: light: bh1780: fix PM runtime leak on error path
Move pm_runtime_put_autosuspend() before the error check to ensure
the PM runtime reference count is always decremented after
pm_runtime_get_sync(), regardless of whether the read operation
succeeds or fails.
Fixes: 1f0477f18306 ("iio: light: new driver for the ROHM BH1780")
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@...log.com>
---
drivers/iio/light/bh1780.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/light/bh1780.c b/drivers/iio/light/bh1780.c
index 5d3c6d5276ba..a740d1f992a8 100644
--- a/drivers/iio/light/bh1780.c
+++ b/drivers/iio/light/bh1780.c
@@ -109,9 +109,9 @@ static int bh1780_read_raw(struct iio_dev *indio_dev,
case IIO_LIGHT:
pm_runtime_get_sync(&bh1780->client->dev);
value = bh1780_read_word(bh1780, BH1780_REG_DLOW);
+ pm_runtime_put_autosuspend(&bh1780->client->dev);
if (value < 0)
return value;
- pm_runtime_put_autosuspend(&bh1780->client->dev);
*val = value;
return IIO_VAL_INT;
--
2.43.0
Powered by blists - more mailing lists