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>
This commit is contained in:
parent
2b6e6b8042
commit
97271c3bcb
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue