summaryrefslogtreecommitdiffstats
path: root/drivers/staging/iio
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2012-07-13 13:04:00 +0100
committerJonathan Cameron <jic23@kernel.org>2012-07-14 09:42:56 +0100
commit97271c3bcb83babe81cab0b79b374c7d732eff41 (patch)
tree468bcd6e12252c637bcc8906dd37415865c1579f /drivers/staging/iio
parent2b6e6b8042a9f783170b0a15e0550a075381726e (diff)
downloadlinux-97271c3bcb83babe81cab0b79b374c7d732eff41.tar.bz2
staging:iio:adis16260: Fix drvdata inconsistency
The SPI drvdata is set to adis16260_state struct in probe(), but assumed to be the iio_dev struct in remove(). Fix this by setting it to the iio_dev in probe(). The issue has been discovered using the following coccinelle patch: // <smpl> @r1@ type T; T data; expression dev; @@ ( spi_set_drvdata(dev, (void *)data) | spi_set_drvdata(dev, data) ) @r2@ type r1.T; T data; position p; expression dev; @@ data = spi_get_drvdata@p(dev) @depends on r1@ position p != r2.p; expression dev; identifier data; @@ *data = spi_get_drvdata@p(dev) // </smpl> 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/gyro/adis16260_core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/staging/iio/gyro/adis16260_core.c b/drivers/staging/iio/gyro/adis16260_core.c
index f16b3938928f..93aa431287ac 100644
--- a/drivers/staging/iio/gyro/adis16260_core.c
+++ b/drivers/staging/iio/gyro/adis16260_core.c
@@ -617,7 +617,7 @@ static int __devinit adis16260_probe(struct spi_device *spi)
if (pd)
st->negate = pd->negate;
/* this is only used for removal purposes */
- spi_set_drvdata(spi, st);
+ spi_set_drvdata(spi, indio_dev);
st->us = spi;
mutex_init(&st->buf_lock);