Skip to content

Commit 56cd3d1

Browse files
M-Vaittinenjic23
authored andcommitted
iio: accel: kx022a fix irq getting
The fwnode_irq_get_byname() was returning 0 at device-tree mapping error. If this occurred, the KX022A driver did abort the probe but errorneously directly returned the return value from fwnode_irq_get_byname() from probe. In case of a device-tree mapping error this indicated success. The fwnode_irq_get_byname() has since been fixed to not return zero on error so the check for fwnode_irq_get_byname() can be relaxed to only treat negative values as errors. This will also do decent fix even when backported to branches where fwnode_irq_get_byname() can still return zero on error because KX022A probe should later fail at IRQ requesting and a prober error handling should follow. Relax the return value check for fwnode_irq_get_byname() to only treat negative values as errors. Reported-by: kernel test robot <[email protected]> Reported-by: Dan Carpenter <[email protected]> Closes: https://lore.kernel.org/r/[email protected]/ Link: https://lore.kernel.org/r/[email protected]/ Signed-off-by: Matti Vaittinen <[email protected]> Fixes: 7c1d167 ("iio: accel: Support Kionix/ROHM KX022A accelerometer") Link: https://lore.kernel.org/r/b45b4b638db109c6078d243252df3a7b0485f7d5.1683875389.git.mazziesaccount@gmail.com Cc: <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
1 parent d049151 commit 56cd3d1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/iio/accel/kionix-kx022a.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1048,7 +1048,7 @@ int kx022a_probe_internal(struct device *dev)
10481048
data->ien_reg = KX022A_REG_INC4;
10491049
} else {
10501050
irq = fwnode_irq_get_byname(fwnode, "INT2");
1051-
if (irq <= 0)
1051+
if (irq < 0)
10521052
return dev_err_probe(dev, irq, "No suitable IRQ\n");
10531053

10541054
data->inc_reg = KX022A_REG_INC5;

0 commit comments

Comments
 (0)