From 97271c3bcb83babe81cab0b79b374c7d732eff41 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Fri, 13 Jul 2012 13:04:00 +0100 Subject: [PATCH] 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: // @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) // Signed-off-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron --- drivers/staging/iio/gyro/adis16260_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- 2.39.5