linux_dsm_epyc7002/drivers/iio/imu/st_lsm6dsx
Stephan Gerhold fb4fbc8904 iio: imu: st_lsm6dsx: Fix selection of ST_LSM6DS3_ID
At the moment, attempting to probe a device with ST_LSM6DS3_ID
(e.g. using the st,lsm6ds3 compatible) fails with:

    st_lsm6dsx_i2c 1-006b: unsupported whoami [69]

... even though 0x69 is the whoami listed for ST_LSM6DS3_ID.

This happens because st_lsm6dsx_check_whoami() also attempts
to match unspecified (zero-initialized) entries in the "id" array.
ST_LSM6DS3_ID = 0 will therefore match any entry in
st_lsm6dsx_sensor_settings (here: the first), because none of them
actually have all 12 entries listed in the "id" array.

Avoid this by additionally checking if "name" is set,
which is only set for valid entries in the "id" array.

Note: Although the problem was introduced earlier it did not surface until
commit 52f4b1f196 ("iio: imu: st_lsm6dsx: add support for accel/gyro unit of lsm9ds1")
because ST_LSM6DS3_ID was the first entry in st_lsm6dsx_sensor_settings.

Fixes: d068e4a0f9 ("iio: imu: st_lsm6dsx: add support to multiple devices with the same settings")
Cc: <stable@vger.kernel.org> # 5.4
Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-13 12:08:28 +01:00
..
Kconfig iio: imu: st_lsm6dsx: add support to LSM6DSRX 2019-10-27 16:38:06 +00:00
Makefile iio: imu: st_lsm6dsx: add i3c basic support for LSM6DSO and LSM6DSR 2019-07-27 22:55:27 +01:00
st_lsm6dsx_buffer.c iio: imu: st_lsm6dsx: track hw FIFO buffering with fifo_mask 2019-12-08 18:10:30 +00:00
st_lsm6dsx_core.c iio: imu: st_lsm6dsx: Fix selection of ST_LSM6DS3_ID 2020-01-13 12:08:28 +01:00
st_lsm6dsx_i2c.c iio: imu: st_lsm6dsx: add support to LSM6DSRX 2019-10-27 16:38:06 +00:00
st_lsm6dsx_i3c.c iio: imu: st_lsm6dsx: add i3c basic support for LSM6DSO and LSM6DSR 2019-07-27 22:55:27 +01:00
st_lsm6dsx_shub.c iio: imu: st_lsm6dsx: express odr in mHZ 2019-11-09 13:23:17 +00:00
st_lsm6dsx_spi.c iio: imu: st_lsm6dsx: add support to LSM6DSRX 2019-10-27 16:38:06 +00:00
st_lsm6dsx.h iio: imu: st_lsm6dsx: track hw FIFO buffering with fifo_mask 2019-12-08 18:10:30 +00:00