Re: [PATCH 1/4] staging:iio:adis16260: Fix drvdata inconsistency

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 07/13/2012 01:04 PM, Lars-Peter Clausen wrote:
> 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@xxxxxxxxxx>
All merged to fixes-togreg.

Thanks
> ---
>  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);
> 


--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux