linux/drivers/iio/accel
Haibo Chen c87b7b12f4 iio: accel: mma8452: use the correct logic to get mma8452_data
The original logic to get mma8452_data is wrong, the *dev point to
the device belong to iio_dev. we can't use this dev to find the
correct i2c_client. The original logic happen to work because it
finally use dev->driver_data to get iio_dev. Here use the API
to_i2c_client() is wrong and make reader confuse. To correct the
logic, it should be like this

  struct mma8452_data *data = iio_priv(dev_get_drvdata(dev));

But after commit 8b7651f259 ("iio: iio_device_alloc(): Remove
unnecessary self drvdata"), the upper logic also can't work.
When try to show the avialable scale in userspace, will meet kernel
dump, kernel handle NULL pointer dereference.

So use dev_to_iio_dev() to correct the logic.

Dual fixes tags as the second reflects when the bug was exposed, whilst
the first reflects when the original bug was introduced.

Fixes: c3cdd6e48e ("iio: mma8452: refactor for seperating chip specific data")
Fixes: 8b7651f259 ("iio: iio_device_alloc(): Remove unnecessary self drvdata")
Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Reviewed-by: Martin Kepplinger <martink@posteo.de>
Cc: <Stable@vger.kernel.org>
Link: https://lore.kernel.org/r/1645497741-5402-1-git-send-email-haibo.chen@nxp.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-03-02 13:38:32 +00:00
..
adis16201.c iio:imu:adis: Move exports into IIO_ADISLIB namespace 2022-02-18 11:42:26 +00:00
adis16209.c iio:imu:adis: Move exports into IIO_ADISLIB namespace 2022-02-18 11:42:26 +00:00
adxl313_core.c iio:accel:adxl313: Move exports into IIO_ADXL313 namespace 2022-02-18 11:36:54 +00:00
adxl313_i2c.c iio:accel:adxl313: Move exports into IIO_ADXL313 namespace 2022-02-18 11:36:54 +00:00
adxl313_spi.c iio:accel:adxl313: Move exports into IIO_ADXL313 namespace 2022-02-18 11:36:54 +00:00
adxl313.h iio: accel: Add driver support for ADXL313 2021-09-14 12:00:35 +01:00
adxl345_core.c iio: accel: adxl345: Drop comma in terminator entries 2022-02-26 19:11:32 +00:00
adxl345_i2c.c iio: accel: adxl345: Remove unneeded blank lines 2022-02-26 19:11:39 +00:00
adxl345_spi.c iio: accel: adxl345: Remove unneeded blank lines 2022-02-26 19:11:39 +00:00
adxl345.h iio: accel: adxl345: Make use of device properties 2022-02-26 19:11:13 +00:00
adxl355_core.c iio:accel:adxl355: Move exports into IIO_ADXL355 namespace 2022-02-18 11:36:54 +00:00
adxl355_i2c.c iio:accel:adxl355: Move exports into IIO_ADXL355 namespace 2022-02-18 11:36:54 +00:00
adxl355_spi.c iio:accel:adxl355: Move exports into IIO_ADXL355 namespace 2022-02-18 11:36:54 +00:00
adxl355.h iio: accel: Add driver support for ADXL355 2021-09-14 12:00:30 +01:00
adxl367_i2c.c iio: accel: add ADXL367 driver 2022-02-21 19:33:06 +00:00
adxl367_spi.c iio: accel: add ADXL367 driver 2022-02-21 19:33:06 +00:00
adxl367.c iio: accel: adxl367: Fix handled initialization in adxl367_irq_handler() 2022-02-26 18:07:10 +00:00
adxl367.h iio: accel: add ADXL367 driver 2022-02-21 19:33:06 +00:00
adxl372_i2c.c iio:accel:adxl372: Move exports into IIO_ADXL372 namespace 2022-02-18 11:36:54 +00:00
adxl372_spi.c iio:accel:adxl372: Move exports into IIO_ADXL372 namespace 2022-02-18 11:36:54 +00:00
adxl372.c iio:accel:adxl372: Move exports into IIO_ADXL372 namespace 2022-02-18 11:36:54 +00:00
adxl372.h iio: adxl372: Add support for I2C communication 2018-09-08 15:54:38 +01:00
bma180.c iio:accel:bma180: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc 2022-02-18 11:46:03 +00:00
bma220_spi.c iio: bma220: Use scan_type when processing raw data 2021-11-17 17:51:40 +00:00
bma400_core.c iio:accel:bma400: Move exports into IIO_BMA400 namespace 2022-02-18 11:36:53 +00:00
bma400_i2c.c iio:accel:bma400: Move exports into IIO_BMA400 namespace 2022-02-18 11:36:53 +00:00
bma400_spi.c iio:accel:bma400: Move exports into IIO_BMA400 namespace 2022-02-18 11:36:53 +00:00
bma400.h iio: accel: bma400: Make bma400_remove() return void 2021-10-19 08:30:45 +01:00
bmc150-accel-core.c iio:accel:bmc150: Move exports into IIO_BMC150 namespace 2022-02-18 11:36:54 +00:00
bmc150-accel-i2c.c iio:accel:bmc150: Move exports into IIO_BMC150 namespace 2022-02-18 11:36:54 +00:00
bmc150-accel-spi.c iio:accel:bmc150: Move exports into IIO_BMC150 namespace 2022-02-18 11:36:54 +00:00
bmc150-accel.h iio: accel: bmc150: Make bmc150_accel_core_remove() return void 2021-10-19 08:30:45 +01:00
bmi088-accel-core.c iio:accel:bmi088: Move exports into IIO_BMI088 namespace 2022-02-18 11:36:54 +00:00
bmi088-accel-spi.c iio:accel:bmi088: Move exports into IIO_BMI088 namespace 2022-02-18 11:36:54 +00:00
bmi088-accel.h iio: accel: bmi088: Make bmi088_accel_core_remove() return void 2021-10-19 08:30:45 +01:00
cros_ec_accel_legacy.c iio: cros: unify hw fifo attributes without API changes 2021-03-25 19:13:52 +00:00
da280.c iio:accel:da280: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc 2022-02-18 11:43:11 +00:00
da311.c iio:accel:da311: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc 2022-02-18 11:43:11 +00:00
dmard06.c iio:accel:dmard06: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc 2022-02-18 11:43:11 +00:00
dmard09.c iio:accel:dmard09: Tidy up white space around {} in id table 2022-01-23 18:03:35 +00:00
dmard10.c iio:accel:dmard10: Switch from CONFIG_PM guards to pm_sleep_ptr() etc 2022-02-18 11:43:11 +00:00
fxls8962af-core.c iio:accel:fxl8962af: Move exports into IIO_FXL8962AF namespace 2022-02-18 11:36:54 +00:00
fxls8962af-i2c.c iio:accel:fxl8962af: Move exports into IIO_FXL8962AF namespace 2022-02-18 11:36:54 +00:00
fxls8962af-spi.c iio:accel:fxl8962af: Move exports into IIO_FXL8962AF namespace 2022-02-18 11:36:54 +00:00
fxls8962af.h iio: accel: add support for FXLS8962AF/FXLS8964AF accelerometers 2021-05-17 13:54:23 +01:00
hid-sensor-accel-3d.c iio: hid-sensors: bind IIO channels alloc to device object 2021-07-13 18:21:53 +01:00
Kconfig iio: accel: add ADXL367 driver 2022-02-21 19:33:06 +00:00
kxcjk-1013.c 1st set of IIO new device support, features and cleanup for 5.17 2021-12-22 12:33:01 +01:00
kxsd9-i2c.c iio:accel:kxsd9: Move exports into IIO_KDSD9 namespace 2022-02-18 11:36:53 +00:00
kxsd9-spi.c iio:accel:kxsd9: Move exports into IIO_KDSD9 namespace 2022-02-18 11:36:53 +00:00
kxsd9.c iio:accel:kxsd9: Move exports into IIO_KDSD9 namespace 2022-02-18 11:36:53 +00:00
kxsd9.h iio: accel: kxsd9: Make kxsd9_common_remove() return void 2021-10-19 08:30:45 +01:00
Makefile iio: accel: add ADXL367 driver 2022-02-21 19:33:06 +00:00
mc3230.c iio:accel:mc3230: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc 2022-02-18 11:43:11 +00:00
mma7455_core.c iio:accel:mma7455_core: Move exports into IIO_MMA7455 namespace 2022-02-18 11:36:53 +00:00
mma7455_i2c.c iio:accel:mma7455_core: Move exports into IIO_MMA7455 namespace 2022-02-18 11:36:53 +00:00
mma7455_spi.c iio:accel:mma7455_core: Move exports into IIO_MMA7455 namespace 2022-02-18 11:36:53 +00:00
mma7455.h iio: accel: mma7455: Make mma7455_core_remove() return void 2021-10-19 08:30:45 +01:00
mma7660.c iio:accel:mma7660: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() 2022-02-18 11:43:11 +00:00
mma8452.c iio: accel: mma8452: use the correct logic to get mma8452_data 2022-03-02 13:38:32 +00:00
mma9551_core.c iio:accel:mma9551_core: Move exports into IIO_MMA9551 namespace 2022-02-18 11:36:53 +00:00
mma9551_core.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 288 2019-06-05 17:36:37 +02:00
mma9551.c iio:accel:mma9551: Switch from CONFIG_PM guards to pm_ptr() etc 2022-02-18 11:43:11 +00:00
mma9553.c iio:accel:mma9553: Switch from CONFIG_PM guards to pm_ptr() etc 2022-02-18 11:43:11 +00:00
mxc4005.c iio: accel: mxc4005: Fix overread of data and alignment issue. 2021-05-17 13:54:28 +01:00
mxc6255.c iio: remove explicit IIO device parent assignment 2020-06-14 11:49:59 +01:00
sca3000.c iio: sca3000: Use scan_type when processing raw data 2021-11-17 17:51:41 +00:00
sca3300.c iio: accel: Add driver for Murata SCA3300 accelerometer 2021-05-17 13:49:09 +01:00
ssp_accel_sensor.c iio:common:ssp_sensors: Move exports into IIO_SSP_SENSORS namespace 2022-02-18 11:42:26 +00:00
st_accel_buffer.c iio:st-sensors: Remove duplicate MODULE_* 2022-02-18 11:36:54 +00:00
st_accel_core.c iio:st-sensors: Move exports into IIO_ST_SENSORS namespace 2022-02-18 11:36:54 +00:00
st_accel_i2c.c iio:st-sensors: Move exports into IIO_ST_SENSORS namespace 2022-02-18 11:36:54 +00:00
st_accel_spi.c iio:st-sensors: Move exports into IIO_ST_SENSORS namespace 2022-02-18 11:36:54 +00:00
st_accel.h iio: accel: st_accel: Add support for Silan SC7A20 2022-02-18 11:35:49 +00:00
stk8ba50.c iio:accel:stk8ba50: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc 2022-02-18 11:43:11 +00:00
stk8312.c iio:accel:stk8312: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc 2022-02-18 11:46:03 +00:00