Skip to contentSkip to conversation

patch "iio: imu: inv_icm42600: Fix broken icm42600 (chip id 0 value)" added to char-misc-linus

PATCH [email protected] 1 participant 1 message Jun 20, 2022

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

    iio: imu: inv_icm42600: Fix broken icm42600 (chip id 0 value)

to my char-misc git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
in the char-misc-linus branch.

The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)

The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.

If you have any questions about this process, please let me know.

From 106b391e1b859100a3f38f0ad874236e9be06bde Mon Sep 17 00:00:00 2001
From: Jean-Baptiste Maneyrol <[email protected]>
Date: Thu, 9 Jun 2022 12:23:01 +0200
Subject: 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 31c24c1e93c3 ("iio: imu: inv_icm42600: add core of new inv_icm42600 driver")
---
 drivers/iio/imu/inv_icm42600/inv_icm42600.h      | 1 +
 drivers/iio/imu/inv_icm42600/inv_icm42600_core.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/iio/imu/inv_icm42600/inv_icm42600.h +1 -0
index c0f5059b13b3..995a9dc06521 100644
@@ -17,6 +17,7 @@
 #include "inv_icm42600_buffer.h"
 
 enum inv_icm42600_chip {
+	INV_CHIP_INVALID,
 	INV_CHIP_ICM42600,
 	INV_CHIP_ICM42602,
 	INV_CHIP_ICM42605,
drivers/iio/imu/inv_icm42600/inv_icm42600_core.c +1 -1
index 86858da9cc38..ca85fccc9839 100644
@@ -565,7 +565,7 @@ int inv_icm42600_core_probe(struct regmap *regmap, int chip, int irq,
 	bool open_drain;
 	int ret;
 
-	if (chip < 0 || chip >= INV_CHIP_NB) {
+	if (chip <= INV_CHIP_INVALID || chip >= INV_CHIP_NB) {
 		dev_err(dev, "invalid chip = %d\n", chip);
 		return -ENODEV;
 	}
Signature · 1 line
2.36.1