Patchwork drivers/rtc/rtc-pl031.c: Pass correct pointer to free_irq()

login
register
mail settings
Submitter Lars-Peter Clausen
Date May 20, 2013, 3:41 p.m.
Message ID <1369064471-30613-1-git-send-email-lars@metafoo.de>
Download mbox | patch
Permalink /patch/245059/
State New
Headers show

Comments

Lars-Peter Clausen - May 20, 2013, 3:41 p.m.
free_irq() expects the same pointer that was passed to request_irq(), otherwise
the IRQ is not freed.

The issue was found using the following coccinelle script:

<smpl>
@r1@
type T;
T devid;
@@
request_irq(..., devid)

@r2@
type r1.T;
T devid;
position p;
@@
free_irq@p(..., devid)

@@
position p != r2.p;
@@
*free_irq@p(...)
</smpl>

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 drivers/rtc/rtc-pl031.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Linus Walleij - May 20, 2013, 6:32 p.m.
On Mon, May 20, 2013 at 5:41 PM, Lars-Peter Clausen <lars@metafoo.de> wrote:

> free_irq() expects the same pointer that was passed to request_irq(), otherwise
> the IRQ is not freed.
>
> The issue was found using the following coccinelle script:

Good job!
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

Patch

diff --git a/drivers/rtc/rtc-pl031.c b/drivers/rtc/rtc-pl031.c
index 8900ea7..0f0609b 100644
--- a/drivers/rtc/rtc-pl031.c
+++ b/drivers/rtc/rtc-pl031.c
@@ -306,7 +306,7 @@  static int pl031_remove(struct amba_device *adev)
 	struct pl031_local *ldata = dev_get_drvdata(&adev->dev);
 
 	amba_set_drvdata(adev, NULL);
-	free_irq(adev->irq[0], ldata->rtc);
+	free_irq(adev->irq[0], ldata);
 	rtc_device_unregister(ldata->rtc);
 	iounmap(ldata->base);
 	kfree(ldata);