Re: [PATCH] iio: imu: inv_icm42600: Fix broken icm42600 (chip id 0 value)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu,  9 Jun 2022 12:23:01 +0200
Jean-Baptiste Maneyrol <jmaneyrol@xxxxxxxxxxxxxx> wrote:

> From: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@xxxxxxx>
> 
> 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")
> Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@xxxxxxx>

Applied to the fixes-togreg branch of iio.git.

Thanks,

Jonathan

> ---
>  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(-)
> 
> diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600.h b/drivers/iio/imu/inv_icm42600/inv_icm42600.h
> index 62fedac54e65..3d91469beccb 100644
> --- a/drivers/iio/imu/inv_icm42600/inv_icm42600.h
> +++ b/drivers/iio/imu/inv_icm42600/inv_icm42600.h
> @@ -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,
> diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c b/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c
> index 86858da9cc38..ca85fccc9839 100644
> --- a/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c
> +++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c
> @@ -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;
>  	}




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux