[PATCH v2] iio: accel: adxl380: fix handling of unavailable "INT1" interrupt

Francesco Lavra posted 1 patch 3 days, 7 hours ago
There is a newer version of this series
drivers/iio/accel/adxl380.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH v2] iio: accel: adxl380: fix handling of unavailable "INT1" interrupt
Posted by Francesco Lavra 3 days, 7 hours ago
fwnode_irq_get_byname() returns a negative value on failure; if a negative
value is returned, use it as `err` argument for dev_err_probe().

Fixes: df36de13677a ("iio: accel: add ADXL380 driver")
Signed-off-by: Francesco Lavra <flavra@baylibre.com>

---

Changes from v1 [1]:
- added fix to `err` argument passed to dev_err_probe() (Andy)

[1] https://lore.kernel.org/linux-iio/aSdDT4upO9shVq0S@smile.fi.intel.com/T/
---
 drivers/iio/accel/adxl380.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/accel/adxl380.c b/drivers/iio/accel/adxl380.c
index 0cf3c6815829..19253aae7f0c 100644
--- a/drivers/iio/accel/adxl380.c
+++ b/drivers/iio/accel/adxl380.c
@@ -1728,8 +1728,8 @@ static int adxl380_config_irq(struct iio_dev *indio_dev)
 		st->int_map[1] = ADXL380_INT0_MAP1_REG;
 	} else {
 		st->irq = fwnode_irq_get_byname(dev_fwnode(st->dev), "INT1");
-		if (st->irq > 0)
-			return dev_err_probe(st->dev, -ENODEV,
+		if (st->irq < 0)
+			return dev_err_probe(st->dev, st->irq,
 					     "no interrupt name specified");
 		st->int_map[0] = ADXL380_INT1_MAP0_REG;
 		st->int_map[1] = ADXL380_INT1_MAP1_REG;
-- 
2.39.5
Re: [PATCH v2] iio: accel: adxl380: fix handling of unavailable "INT1" interrupt
Posted by Andy Shevchenko 3 days, 6 hours ago
On Fri, Nov 28, 2025 at 4:07 PM Francesco Lavra <flavra@baylibre.com> wrote:
>
> fwnode_irq_get_byname() returns a negative value on failure; if a negative
> value is returned, use it as `err` argument for dev_err_probe().

Reviewed-by: Andy Shevchenko <andy@kernel.org>

...

> +               if (st->irq < 0)
> +                       return dev_err_probe(st->dev, st->irq,
>                                              "no interrupt name specified");

Just noticed that the trailing \n is missing.
Can be also folded or done in a separate patch. Up to you.

-- 
With Best Regards,
Andy Shevchenko