linux/drivers/iio/humidity
Jonathan Cameron e765537add Revert "iio:humidity:si7020: fix pointer to i2c client"
This reverts commit e0922e5e3c.
Requested by Andrey Smirnov.

It incorrectly assumes that the level of indirection is not needed
which is not true(probably because the driver incorrectly allocates
sizeof(*client) instead of sizeof(*data) via devm_iio_device_alloc).
If you look at the code of the probe function(see below) it is easy to
see that what is being stored in the private memory of the IIO device
instance is not a copy of a 'struct i2c_client' but a pointer to an
instance passed as an argument to the probe function.

struct i2c_client **data;
int ret;

< Some code skipped >

indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*client));
if (!indio_dev)
return -ENOMEM;

data = iio_priv(indio_dev);
*data = client;

Without reverting this change any read of a raw value of this sensor
leads to a kernel oops due to a NULL pointer de-reference on my
hardware setup.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Cc: Stable@vger.kernel.org
2015-02-14 11:32:17 +00:00
..
dht11.c iio: dht11: IRQ fixes 2015-01-10 11:16:32 +00:00
Kconfig IIO: add si7020 driver 2014-10-04 12:43:30 +01:00
Makefile IIO: add si7020 driver 2014-10-04 12:43:30 +01:00
si7005.c iio: Add si7005 relative humidity and temperature sensor driver 2014-01-11 11:12:44 +00:00
si7020.c Revert "iio:humidity:si7020: fix pointer to i2c client" 2015-02-14 11:32:17 +00:00