All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] staging:iio:adis16260: Fix drvdata inconsistency
@ 2012-07-13 12:04 Lars-Peter Clausen
  2012-07-13 12:04 ` [PATCH 2/4] staging:iio:tsl2x7x: Fix client data inconsistency Lars-Peter Clausen
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Lars-Peter Clausen @ 2012-07-13 12:04 UTC (permalink / raw)
  To: Jonathan Cameron; +Cc: linux-iio, Lars-Peter Clausen

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>
---
 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 f16b393..93aa431 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);
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-07-14  8:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-13 12:04 [PATCH 1/4] staging:iio:adis16260: Fix drvdata inconsistency Lars-Peter Clausen
2012-07-13 12:04 ` [PATCH 2/4] staging:iio:tsl2x7x: Fix client data inconsistency Lars-Peter Clausen
2012-07-13 12:04 ` [PATCH 3/4] staging:iio:lpc32xx_adc: Ensure request_irq and free_irq dev_id parameter match Lars-Peter Clausen
2012-07-13 12:04 ` [PATCH 4/4] staging:iio:tsl2x7x: " Lars-Peter Clausen
2012-07-14  8:46 ` [PATCH 1/4] staging:iio:adis16260: Fix drvdata inconsistency Jonathan Cameron

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.