[PATCH] iio: adc: ade9000: fix wrong return type in streaming push

Giorgi Tchankvetadze posted 1 patch 1 month, 3 weeks ago
There is a newer version of this series
drivers/iio/adc/ade9000.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] iio: adc: ade9000: fix wrong return type in streaming push
Posted by Giorgi Tchankvetadze 1 month, 3 weeks ago
The else branch of ade9000_iio_push_streaming() incorrectly returns
IRQ_HANDLED on regmap_write failure. This function returns int (0 on
success, negative errno on failure), so IRQ_HANDLED (1) would be
misinterpreted as a non-error by callers.

Return ret instead, consistent with every other error path in the
function. Also add the missing newline in the error message.

Signed-off-by: Giorgi Tchankvetadze <giorgitchankvetadze1997@gmail.com>
---
 drivers/iio/adc/ade9000.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/adc/ade9000.c b/drivers/iio/adc/ade9000.c
index 5dcc26a08970..07e84c6257d4 100644
--- a/drivers/iio/adc/ade9000.c
+++ b/drivers/iio/adc/ade9000.c
@@ -786,8 +786,8 @@ static int ade9000_iio_push_streaming(struct iio_dev *indio_dev)
 		ret = regmap_write(st->regmap, ADE9000_REG_WFB_PG_IRQEN,
 				   ADE9000_MIDDLE_PAGE_BIT);
 		if (ret) {
-			dev_err_ratelimited(dev, "IRQ0 WFB write fail");
-			return IRQ_HANDLED;
+			dev_err_ratelimited(dev, "IRQ0 WFB write fail\n");
+			return ret;
 		}
 
 		ade9000_configure_scan(indio_dev, ADE9000_REG_WF_BUFF);
-- 
2.52.0
[PATCH v2] iio: adc: ade9000: fix wrong return type in streaming push
Posted by Giorgi Tchankvetadze 1 month, 3 weeks ago
The else branch of ade9000_iio_push_streaming() incorrectly returns
IRQ_HANDLED on regmap_write failure. This function returns int (0 on
success, negative errno on failure), so IRQ_HANDLED (1) would be
misinterpreted as a non-error by callers.

Return ret instead, consistent with every other error path in the
function.

Fixes: 81de7b4619fc ("iio: adc: add ade9000 support")
Signed-off-by: Giorgi Tchankvetadze <giorgitchankvetadze1997@gmail.com>
---
Changes in v2 (Antoniu Miclaus):
 - Drop unrelated newline fix
 - Add Fixes tag

 drivers/iio/adc/ade9000.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/adc/ade9000.c b/drivers/iio/adc/ade9000.c
index 5dcc26a08970..5d659f1bd3f7 100644
--- a/drivers/iio/adc/ade9000.c
+++ b/drivers/iio/adc/ade9000.c
@@ -787,7 +787,7 @@ static int ade9000_iio_push_streaming(struct iio_dev *indio_dev)
 				   ADE9000_MIDDLE_PAGE_BIT);
 		if (ret) {
 			dev_err_ratelimited(dev, "IRQ0 WFB write fail");
-			return IRQ_HANDLED;
+			return ret;
 		}
 
 		ade9000_configure_scan(indio_dev, ADE9000_REG_WF_BUFF);
-- 
2.52.0
Re: [PATCH v2] iio: adc: ade9000: fix wrong return type in streaming push
Posted by Andy Shevchenko 1 month, 3 weeks ago
On Tue, Feb 24, 2026 at 05:23:55PM +0400, Giorgi Tchankvetadze wrote:
> The else branch of ade9000_iio_push_streaming() incorrectly returns
> IRQ_HANDLED on regmap_write failure. This function returns int (0 on
> success, negative errno on failure), so IRQ_HANDLED (1) would be
> misinterpreted as a non-error by callers.
> 
> Return ret instead, consistent with every other error path in the
> function.

Again, do NOT start a _new_ version in the _previous_ version email thread.

-- 
With Best Regards,
Andy Shevchenko