staging:iio:tsl2x7x: Ensure request_irq and free_irq dev_id parameter match
authorLars-Peter Clausen <lars@metafoo.de>
Fri, 13 Jul 2012 12:04:00 +0000 (13:04 +0100)
committerJonathan Cameron <jic23@kernel.org>
Sat, 14 Jul 2012 08:42:57 +0000 (09:42 +0100)
The data parameters for request_irq and free_irq have to match, otherwise the
IRQ wont be freed.

The issue has been discovered using the following coccinelle patch:

// <smpl>
@r1@
type T;
T data;
@@
(
request_irq(..., (void *)data)
|
request_irq(..., data)
|
request_threaded_irq(..., (void *)data)
|
request_threaded_irq(..., data)
)

@r2@
type r1.T;
T data;
position p;
@@
(
free_irq@p(..., (void *)data)
|
free_irq@p(..., data)
)

@depends on r1@
position p != r2.p;
@@
*free_irq@p(...)

// </smpl>

Cc: Jon Brenner <jbrenner@taosinc.com>
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/staging/iio/light/tsl2x7x_core.c

index 7944686057ccd9e042fef1c613e9756cd7f634e1..497a977ae411b2d799b1d22e63a4846b51fa584a 100644 (file)
@@ -2029,13 +2029,12 @@ static int tsl2x7x_resume(struct device *dev)
 static int __devexit tsl2x7x_remove(struct i2c_client *client)
 {
        struct iio_dev *indio_dev = i2c_get_clientdata(client);
-       struct tsl2X7X_chip *chip = iio_priv(indio_dev);
 
        tsl2x7x_chip_off(indio_dev);
 
        iio_device_unregister(indio_dev);
        if (client->irq)
-               free_irq(client->irq, chip->client->name);
+               free_irq(client->irq, indio_dev);
 
        iio_device_free(indio_dev);