From: Haotian Zhang <vulab@iscas.ac.cn>
To: wbg@kernel.org, andriy.shevchenko@linux.intel.com
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
Haotian Zhang <vulab@iscas.ac.cn>
Subject: [PATCH v2] counter: 104-quad-8: Fix incorrect return value in IRQ handler
Date: Sun, 7 Dec 2025 02:00:07 +0800 [thread overview]
Message-ID: <20251206180007.1365-1-vulab@iscas.ac.cn> (raw)
In-Reply-To: <20251202083952.1975-1-vulab@iscas.ac.cn>
quad8_irq_handler() should return irqreturn_t enum values, but it
directly returns negative errno codes from regmap operations on error.
Return IRQ_NONE if the interrupt status cannot be read. If clearing the
interrupt fails, return IRQ_HANDLED to prevent the kernel from disabling
the IRQ line due to a spurious interrupt storm. Also, log these regmap
failures with WARN_ONCE.
Fixes: 98ffe0252911 ("counter: 104-quad-8: Migrate to the regmap API")
Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
---
Changes in v2:
-Return IRQ_HANDLED if regmap_write() fails.
-Add WARN_ONCE() to log the error messages.
---
drivers/counter/104-quad-8.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/counter/104-quad-8.c b/drivers/counter/104-quad-8.c
index ce81fc4e1ae7..836ab9349dd7 100644
--- a/drivers/counter/104-quad-8.c
+++ b/drivers/counter/104-quad-8.c
@@ -1200,8 +1200,10 @@ static irqreturn_t quad8_irq_handler(int irq, void *private)
int ret;
ret = regmap_read(priv->map, QUAD8_INTERRUPT_STATUS, &status);
- if (ret)
- return ret;
+ if (ret) {
+ WARN_ONCE(true, "quad8: regmap_read failed: %d\n", ret);
+ return IRQ_NONE;
+ }
if (!status)
return IRQ_NONE;
@@ -1232,8 +1234,10 @@ static irqreturn_t quad8_irq_handler(int irq, void *private)
}
ret = regmap_write(priv->map, QUAD8_CHANNEL_OPERATION, CLEAR_PENDING_INTERRUPTS);
- if (ret)
- return ret;
+ if (ret) {
+ WARN_ONCE(true, "quad8: regmap_write failed: %d\n", ret);
+ return IRQ_HANDLED;
+ }
return IRQ_HANDLED;
}
--
2.50.1.windows.1
next prev parent reply other threads:[~2025-12-06 18:01 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <tQ6gupeNR5WXy61K0UZmDNzA2jlqAjibu-EqYV_XRtlg9D0x97yhFy6HUvzN7vLm6DePuDcSVd_qZ_lqin6_8Q==@protonmail.internalid>
2025-12-02 8:39 ` [PATCH] counter: 104-quad-8: Fix incorrect return value in IRQ handler Haotian Zhang
2025-12-06 4:24 ` William Breathitt Gray
2025-12-06 16:30 ` Andy Shevchenko
2025-12-06 18:00 ` Haotian Zhang [this message]
2025-12-12 3:34 ` [PATCH v2] " William Breathitt Gray
2025-12-12 15:04 ` Andy Shevchenko
2025-12-15 2:01 ` [PATCH v3] " Haotian Zhang
2025-12-22 11:06 ` William Breathitt Gray
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251206180007.1365-1-vulab@iscas.ac.cn \
--to=vulab@iscas.ac.cn \
--cc=andriy.shevchenko@linux.intel.com \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=wbg@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox