Skip to contentSkip to conversation

iio: accel: adxl380: fix handling of unavailable "INT1" interrupt

PATCH Applied Francesco Lavra 3 participants 3 messages Nov 28, 2025 – Dec 7, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 iio: accel: adxl380: fix handling of unavailable "INT1" interrupt

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(). While at it, add a missing trailing newline to the dev_err_probe() error message.

Fixes df36de13677a ("iio: accel: add ADXL380 driver")

---
Changes from v2 [2]:
- added missing trailing newline to the dev_err_probe() error message (Andy)
- added Andy's Reviewed-by tag
Changes from v1 [1]:
- added fix to err argument passed to dev_err_probe() (Andy)

[1] https://lore.kernel.org/linux-iio/[email protected]/T/
[2] https://lore.kernel.org/linux-iio/[email protected]/T/

 drivers/iio/accel/adxl380.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/iio/accel/adxl380.c +3 -3
index 0cf3c6815829..6d82873357cb 100644
@@ -1728,9 +1728,9 @@ 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,
-					     "no interrupt name specified");
+		if (st->irq < 0)
+			return dev_err_probe(st->dev, st->irq,
+					     "no interrupt name specified\n");
 		st->int_map[0] = ADXL380_INT1_MAP0_REG;
 		st->int_map[1] = ADXL380_INT1_MAP1_REG;
 	}
Signature · 1 line
2.39.5
Reviewed-by on v3 1/1
#1 lore raw
Quoted 9 lines · Francesco Lavra

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(). While at it, add a missing trailing newline to the dev_err_probe() error message.

Fixes df36de13677a ("iio: accel: add ADXL380 driver")

---

Quoted 31 lines

Changes from v2 [2]:
- added missing trailing newline to the dev_err_probe() error message (Andy)
- added Andy's Reviewed-by tag
Changes from v1 [1]:
- added fix to err argument passed to dev_err_probe() (Andy)

[1] https://lore.kernel.org/linux-iio/[email protected]/T/
[2]
https://lore.kernel.org/linux-iio/[email protected]/T/

 drivers/iio/accel/adxl380.c | 6 +++---

 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/iio/accel/adxl380.c +3 -3
index 0cf3c6815829..6d82873357cb 100644
@@ -1728,9 +1728,9 @@ 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,
-					     "no interrupt name specified");
+		if (st->irq < 0)
+			return dev_err_probe(st->dev, st->irq,
+					     "no interrupt name specified\n");
  		st->int_map[0] = ADXL380_INT1_MAP0_REG;
  		st->int_map[1] = ADXL380_INT1_MAP1_REG;
  	}
maintainer Applied
#2 lore raw
In reply to Francesco Lavra
Quoted 8 lines · On Fri, 28 Nov 2025 18:21:38 +0100 Francesco Lavra <[email protected]> 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(). While at it, add a missing trailing newline to the dev_err_probe() error message.

Fixes df36de13677a ("iio: accel: add ADXL380 driver")

Ouch.

Applied to the fixes-togreg branch of iio.git. That one won't go out until I can rebase on rc1 after next weekend.

Thanks,

Jonathan

Quoted 31 lines

---
Changes from v2 [2]:
- added missing trailing newline to the dev_err_probe() error message (Andy)
- added Andy's Reviewed-by tag
Changes from v1 [1]:
- added fix to err argument passed to dev_err_probe() (Andy)

[1] https://lore.kernel.org/linux-iio/[email protected]/T/
[2] https://lore.kernel.org/linux-iio/[email protected]/T/

 drivers/iio/accel/adxl380.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/iio/accel/adxl380.c +3 -3
index 0cf3c6815829..6d82873357cb 100644
@@ -1728,9 +1728,9 @@ 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,
-					     "no interrupt name specified");
+		if (st->irq < 0)
+			return dev_err_probe(st->dev, st->irq,
+					     "no interrupt name specified\n");
 		st->int_map[0] = ADXL380_INT1_MAP0_REG;
 		st->int_map[1] = ADXL380_INT1_MAP1_REG;
 	}