2013-05-20 14:51:57

by Lars-Peter Clausen

[permalink] [raw]
Subject: [PATCH 1/7] input: ep93xx_keypad: Pass correct pointer to free_irq()

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>

Cc: H Hartley Sweeten <[email protected]>
Signed-off-by: Lars-Peter Clausen <[email protected]>
---
drivers/input/keyboard/ep93xx_keypad.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/input/keyboard/ep93xx_keypad.c b/drivers/input/keyboard/ep93xx_keypad.c
index a8d5aac..47206bd 100644
--- a/drivers/input/keyboard/ep93xx_keypad.c
+++ b/drivers/input/keyboard/ep93xx_keypad.c
@@ -329,7 +329,7 @@ static int ep93xx_keypad_probe(struct platform_device *pdev)
return 0;

failed_free_irq:
- free_irq(keypad->irq, pdev);
+ free_irq(keypad->irq, keypad);
failed_free_dev:
input_free_device(input_dev);
failed_put_clk:
@@ -350,7 +350,7 @@ static int ep93xx_keypad_remove(struct platform_device *pdev)
struct ep93xx_keypad *keypad = platform_get_drvdata(pdev);
struct resource *res;

- free_irq(keypad->irq, pdev);
+ free_irq(keypad->irq, keypad);

if (keypad->enabled)
clk_disable(keypad->clk);
--
1.8.0


2013-05-20 14:52:02

by Lars-Peter Clausen

[permalink] [raw]
Subject: [PATCH 7/7] input: navpoint: Pass correct pointer to free_irq()

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 <[email protected]>
---
drivers/input/mouse/navpoint.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/mouse/navpoint.c b/drivers/input/mouse/navpoint.c
index 8e1b98e..0b8d335 100644
--- a/drivers/input/mouse/navpoint.c
+++ b/drivers/input/mouse/navpoint.c
@@ -287,7 +287,7 @@ static int navpoint_probe(struct platform_device *pdev)
return 0;

err_free_irq:
- free_irq(ssp->irq, &pdev->dev);
+ free_irq(ssp->irq, navpoint);
err_free_mem:
input_free_device(input);
kfree(navpoint);
--
1.8.0

2013-05-20 14:52:00

by Lars-Peter Clausen

[permalink] [raw]
Subject: [PATCH 5/7] input: ixp4xx-beeper: Pass correct pointer to free_irq()

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>

Cc: Alessandro Zummo <[email protected]>
Signed-off-by: Lars-Peter Clausen <[email protected]>
---
drivers/input/misc/ixp4xx-beeper.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/input/misc/ixp4xx-beeper.c b/drivers/input/misc/ixp4xx-beeper.c
index 6ab3dec..deab4a11 100644
--- a/drivers/input/misc/ixp4xx-beeper.c
+++ b/drivers/input/misc/ixp4xx-beeper.c
@@ -125,7 +125,7 @@ static int ixp4xx_spkr_probe(struct platform_device *dev)
return 0;

err_free_irq:
- free_irq(IRQ_IXP4XX_TIMER2, dev);
+ free_irq(IRQ_IXP4XX_TIMER2, (void *)dev->id);
err_free_device:
input_free_device(input_dev);

@@ -144,7 +144,7 @@ static int ixp4xx_spkr_remove(struct platform_device *dev)
disable_irq(IRQ_IXP4XX_TIMER2);
ixp4xx_spkr_control(pin, 0);

- free_irq(IRQ_IXP4XX_TIMER2, dev);
+ free_irq(IRQ_IXP4XX_TIMER2, (void *)dev->id);

return 0;
}
--
1.8.0

2013-05-20 14:52:49

by Lars-Peter Clausen

[permalink] [raw]
Subject: [PATCH 6/7] input: pmic8xxx-pwrkey: Pass correct pointer to free_irq()

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>

Cc: Trilok Soni <[email protected]>
Signed-off-by: Lars-Peter Clausen <[email protected]>
---
drivers/input/misc/pmic8xxx-pwrkey.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/misc/pmic8xxx-pwrkey.c b/drivers/input/misc/pmic8xxx-pwrkey.c
index afd0af9..b49b738 100644
--- a/drivers/input/misc/pmic8xxx-pwrkey.c
+++ b/drivers/input/misc/pmic8xxx-pwrkey.c
@@ -175,7 +175,7 @@ static int pmic8xxx_pwrkey_probe(struct platform_device *pdev)
return 0;

free_press_irq:
- free_irq(key_press_irq, NULL);
+ free_irq(key_press_irq, pwrkey);
unreg_input_dev:
input_unregister_device(pwr);
pwr = NULL;
--
1.8.0

2013-05-20 14:51:55

by Lars-Peter Clausen

[permalink] [raw]
Subject: [PATCH 2/7] input: pxa27x_keypad: Pass correct pointer to free_irq()

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 <[email protected]>
---
drivers/input/keyboard/pxa27x_keypad.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/input/keyboard/pxa27x_keypad.c b/drivers/input/keyboard/pxa27x_keypad.c
index 74e30cc..b674e7a 100644
--- a/drivers/input/keyboard/pxa27x_keypad.c
+++ b/drivers/input/keyboard/pxa27x_keypad.c
@@ -582,7 +582,7 @@ static int pxa27x_keypad_probe(struct platform_device *pdev)
return 0;

failed_free_irq:
- free_irq(irq, pdev);
+ free_irq(irq, keypad);
failed_put_clk:
clk_put(keypad->clk);
failed_free_io:
@@ -600,7 +600,7 @@ static int pxa27x_keypad_remove(struct platform_device *pdev)
struct pxa27x_keypad *keypad = platform_get_drvdata(pdev);
struct resource *res;

- free_irq(keypad->irq, pdev);
+ free_irq(keypad->irq, keypad);
clk_put(keypad->clk);

input_unregister_device(keypad->input_dev);
--
1.8.0

2013-05-20 14:54:01

by Lars-Peter Clausen

[permalink] [raw]
Subject: [PATCH 4/7] input: w90p910_keypad: Pass correct pointer to free_irq()

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>

Cc: Wan ZongShun <[email protected]>
Signed-off-by: Lars-Peter Clausen <[email protected]>
---
drivers/input/keyboard/w90p910_keypad.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/input/keyboard/w90p910_keypad.c b/drivers/input/keyboard/w90p910_keypad.c
index 72e6a56..7b03916 100644
--- a/drivers/input/keyboard/w90p910_keypad.c
+++ b/drivers/input/keyboard/w90p910_keypad.c
@@ -221,7 +221,7 @@ static int w90p910_keypad_probe(struct platform_device *pdev)
return 0;

failed_free_irq:
- free_irq(irq, pdev);
+ free_irq(irq, keypad);
failed_put_clk:
clk_put(keypad->clk);
failed_free_io:
@@ -239,7 +239,7 @@ static int w90p910_keypad_remove(struct platform_device *pdev)
struct w90p910_keypad *keypad = platform_get_drvdata(pdev);
struct resource *res;

- free_irq(keypad->irq, pdev);
+ free_irq(keypad->irq, keypad);

clk_put(keypad->clk);

--
1.8.0

2013-05-20 14:54:27

by Lars-Peter Clausen

[permalink] [raw]
Subject: [PATCH 3/7] input: twl4030_keypad: Pass correct pointer to free_irq()

free_irq() expects the same pointer that was passed to request_threaded_irq(),
otherwise the IRQ is not freed.

The issue was found using the following coccinelle script:

<smpl>
@r1@
type T;
T devid;
@@
request_threaded_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 <[email protected]>
---
drivers/input/keyboard/twl4030_keypad.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/keyboard/twl4030_keypad.c b/drivers/input/keyboard/twl4030_keypad.c
index f05ee1db..d2d178c 100644
--- a/drivers/input/keyboard/twl4030_keypad.c
+++ b/drivers/input/keyboard/twl4030_keypad.c
@@ -422,7 +422,7 @@ static int twl4030_kp_probe(struct platform_device *pdev)
err3:
/* mask all events - we don't care about the result */
(void) twl4030_kpwrite_u8(kp, 0xff, KEYP_IMR1);
- free_irq(kp->irq, NULL);
+ free_irq(kp->irq, kp);
err2:
input_unregister_device(input);
input = NULL;
--
1.8.0

2013-05-20 15:51:24

by Hartley Sweeten

[permalink] [raw]
Subject: RE: [PATCH 1/7] input: ep93xx_keypad: Pass correct pointer to free_irq()

On Monday, May 20, 2013 7:51 AM, Lars-Peter Clausen wrote:
> free_irq() expects the same pointer that was passed to request_irq(), otherwise
> the IRQ is not freed.

<snip>

> Cc: H Hartley Sweeten <[email protected]>
> Signed-off-by: Lars-Peter Clausen <[email protected]>
> ---
> drivers/input/keyboard/ep93xx_keypad.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)

Thanks,

Acked-by: H Hartley Sweeten <[email protected]>

2013-05-23 16:31:50

by Dmitry Torokhov

[permalink] [raw]
Subject: Re: [PATCH 1/7] input: ep93xx_keypad: Pass correct pointer to free_irq()

On Mon, May 20, 2013 at 10:49:00AM -0500, H Hartley Sweeten wrote:
> On Monday, May 20, 2013 7:51 AM, Lars-Peter Clausen wrote:
> > free_irq() expects the same pointer that was passed to request_irq(), otherwise
> > the IRQ is not freed.
>
> <snip>
>
> > Cc: H Hartley Sweeten <[email protected]>
> > Signed-off-by: Lars-Peter Clausen <[email protected]>
> > ---
> > drivers/input/keyboard/ep93xx_keypad.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
>
> Thanks,
>
> Acked-by: H Hartley Sweeten <[email protected]>
>

Applied all, thank you.

--
Dmitry