Skip to content

Commit 106b391

Browse files
jmaneyrol-invnjic23
authored andcommitted
iio: imu: inv_icm42600: Fix broken icm42600 (chip id 0 value)
The 0 value used for INV_CHIP_ICM42600 was not working since the match in i2c/spi was checking against NULL value. To keep this check, add a first INV_CHIP_INVALID 0 value as safe guard. Fixes: 31c24c1 ("iio: imu: inv_icm42600: add core of new inv_icm42600 driver") Signed-off-by: Jean-Baptiste Maneyrol <[email protected]> Link: https://lore.kernel.org/r/[email protected] Cc: <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
1 parent f1a633b commit 106b391

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

drivers/iio/imu/inv_icm42600/inv_icm42600.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "inv_icm42600_buffer.h"
1818

1919
enum inv_icm42600_chip {
20+
INV_CHIP_INVALID,
2021
INV_CHIP_ICM42600,
2122
INV_CHIP_ICM42602,
2223
INV_CHIP_ICM42605,

drivers/iio/imu/inv_icm42600/inv_icm42600_core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ int inv_icm42600_core_probe(struct regmap *regmap, int chip, int irq,
565565
bool open_drain;
566566
int ret;
567567

568-
if (chip < 0 || chip >= INV_CHIP_NB) {
568+
if (chip <= INV_CHIP_INVALID || chip >= INV_CHIP_NB) {
569569
dev_err(dev, "invalid chip = %d\n", chip);
570570
return -ENODEV;
571571
}

0 commit comments

Comments
 (0)