Linux kernel -stable discussions
 help / color / mirror / Atom feed
* [PATCH] iio: pressure: rohm-bm1390: notify trigger on all error paths
@ 2026-05-17 16:08 Stepan Ionichev
  2026-05-17 17:12 ` David Lechner
                   ` (2 more replies)
  0 siblings, 3 replies; 19+ messages in thread
From: Stepan Ionichev @ 2026-05-17 16:08 UTC (permalink / raw)
  To: mazziesaccount
  Cc: jic23, dlechner, nuno.sa, andy, linux-iio, linux-kernel, stable,
	sozdayvek

bm1390_trigger_handler() has three error returns:

	if (ret || !status)
		return IRQ_NONE;          /* status read failed */
	...
	if (ret) {
		dev_warn(...);
		return IRQ_NONE;          /* pressure read failed */
	}
	...
	if (ret) {
		dev_warn(...);
		return IRQ_HANDLED;       /* temp read failed */
	}

None of them call iio_trigger_notify_done(). The success path at the
end does, so on a single transient regmap or pressure-read error the
trigger never sees its use_count decremented, and the
!atomic_read(&trig->use_count) guard in iio_trigger_poll_chained()
drops every subsequent dispatch for that trigger. The buffered-data
flow stays wedged until the trigger is detached.

The IRQ_HANDLED return on the temperature path additionally leaves
the temp branch's last partial state in &data->buf.temp without
pushing the sample, which is the existing intended behaviour; only
the missing notify_done() needs fixing.

Funnel all returns through a single 'done' label that calls
iio_trigger_notify_done() before returning the saved irqreturn_t.

Fixes: 81ca5979b6ed ("iio: pressure: Support ROHM BU1390")
Cc: stable@vger.kernel.org
Signed-off-by: Stepan Ionichev <sozdayvek@gmail.com>
---
 drivers/iio/pressure/rohm-bm1390.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/iio/pressure/rohm-bm1390.c b/drivers/iio/pressure/rohm-bm1390.c
index 08146ca0f..c18352399 100644
--- a/drivers/iio/pressure/rohm-bm1390.c
+++ b/drivers/iio/pressure/rohm-bm1390.c
@@ -626,12 +626,15 @@ static irqreturn_t bm1390_trigger_handler(int irq, void *p)
 	struct iio_poll_func *pf = p;
 	struct iio_dev *idev = pf->indio_dev;
 	struct bm1390_data *data = iio_priv(idev);
+	irqreturn_t result = IRQ_HANDLED;
 	int ret, status;
 
 	/* DRDY is acked by reading status reg */
 	ret = regmap_read(data->regmap, BM1390_REG_STATUS, &status);
-	if (ret || !status)
-		return IRQ_NONE;
+	if (ret || !status) {
+		result = IRQ_NONE;
+		goto done;
+	}
 
 	dev_dbg(data->dev, "DRDY trig status 0x%x\n", status);
 
@@ -639,7 +642,8 @@ static irqreturn_t bm1390_trigger_handler(int irq, void *p)
 		ret = bm1390_pressure_read(data, &data->buf.pressure);
 		if (ret) {
 			dev_warn(data->dev, "sample read failed %d\n", ret);
-			return IRQ_NONE;
+			result = IRQ_NONE;
+			goto done;
 		}
 	}
 
@@ -648,15 +652,16 @@ static irqreturn_t bm1390_trigger_handler(int irq, void *p)
 				       &data->buf.temp, sizeof(data->buf.temp));
 		if (ret) {
 			dev_warn(data->dev, "temp read failed %d\n", ret);
-			return IRQ_HANDLED;
+			goto done;
 		}
 	}
 
 	iio_push_to_buffers_with_ts(idev, &data->buf, sizeof(data->buf),
 				    data->timestamp);
+done:
 	iio_trigger_notify_done(idev->trig);
 
-	return IRQ_HANDLED;
+	return result;
 }
 
 /* Get timestamps and wake the thread if we need to read data */
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2026-05-29  8:21 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-17 16:08 [PATCH] iio: pressure: rohm-bm1390: notify trigger on all error paths Stepan Ionichev
2026-05-17 17:12 ` David Lechner
2026-05-17 17:18   ` Stepan Ionichev
2026-05-18  5:21   ` Matti Vaittinen
2026-05-18  6:59     ` Andy Shevchenko
2026-05-18  7:35       ` Matti Vaittinen
2026-05-18 14:55       ` Jonathan Cameron
2026-05-18 18:31         ` Andy Shevchenko
2026-05-20 10:39           ` Jonathan Cameron
2026-05-18 14:50     ` Jonathan Cameron
2026-05-18  6:54 ` Andy Shevchenko
2026-05-18  9:42 ` [PATCH v2] " Stepan Ionichev
2026-05-18 10:42   ` Andy Shevchenko
2026-05-18 13:06   ` Matti Vaittinen
2026-05-18 15:15   ` Jonathan Cameron
2026-05-19  5:48     ` Matti Vaittinen
2026-05-20 11:08       ` Jonathan Cameron
2026-05-22 12:38         ` Matti Vaittinen
2026-05-29  8:21           ` Matti Vaittinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox