diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2012-07-13 12:04:00 (GMT) |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2012-07-14 08:42:56 (GMT) |
commit | 79d2a6bd14b117f140817b7d258a54bb5c963473 (patch) | |
tree | 8e4a10acdd9a468b6373fd9278d64651f74d48e7 /drivers/staging/iio | |
parent | 97271c3bcb83babe81cab0b79b374c7d732eff41 (diff) | |
download | linux-fsl-qoriq-79d2a6bd14b117f140817b7d258a54bb5c963473.tar.xz |
staging:iio:tsl2x7x: Fix client data inconsistency
In probe the I2C client data is set to the iio_dev struct in probe(), but
assumed to be the tsl2X7X_chip struct in remove(). Fix this by reading the
client data back as iio_dev as well.
The issue has been discovered using the following coccinelle patch:
// <smpl>
@r1@
type T;
T data;
expression dev;
@@
(
i2c_set_clientdata(dev, (void *)data)
|
i2c_set_clientdata(dev, data)
)
@r2@
type r1.T;
T data;
position p;
expression dev;
@@
data = i2c_get_clientdata@p(dev)
@depends on r1@
position p != r2.p;
expression dev;
identifier data;
@@
*data = i2c_get_clientdata@p(dev)
// </smpl>
Cc: Jon Brenner <jbrenner@taosinc.com>
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/staging/iio')
-rw-r--r-- | drivers/staging/iio/light/tsl2x7x_core.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/staging/iio/light/tsl2x7x_core.c b/drivers/staging/iio/light/tsl2x7x_core.c index fdf75e4..7944686 100644 --- a/drivers/staging/iio/light/tsl2x7x_core.c +++ b/drivers/staging/iio/light/tsl2x7x_core.c @@ -2028,8 +2028,8 @@ static int tsl2x7x_resume(struct device *dev) static int __devexit tsl2x7x_remove(struct i2c_client *client) { - struct tsl2X7X_chip *chip = i2c_get_clientdata(client); - struct iio_dev *indio_dev = iio_priv_to_dev(chip); + struct iio_dev *indio_dev = i2c_get_clientdata(client); + struct tsl2X7X_chip *chip = iio_priv(indio_dev); tsl2x7x_chip_off(indio_dev); |