All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tty: nwpserial: Pass correct pointer to free_irq()
@ 2013-05-20 17:07 Lars-Peter Clausen
  2013-05-21  7:18 ` Benjamin Krill
  0 siblings, 1 reply; 2+ messages in thread
From: Lars-Peter Clausen @ 2013-05-20 17:07 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Benjamin Krill, linux-serial, linux-kernel, Lars-Peter Clausen

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/tty/serial/nwpserial.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/nwpserial.c b/drivers/tty/serial/nwpserial.c
index 77287c5..549c70a 100644
--- a/drivers/tty/serial/nwpserial.c
+++ b/drivers/tty/serial/nwpserial.c
@@ -199,7 +199,7 @@ static void nwpserial_shutdown(struct uart_port *port)
 	dcr_write(up->dcr_host, UART_IER, up->ier);
 
 	/* free irq */
-	free_irq(up->port.irq, port);
+	free_irq(up->port.irq, up);
 }
 
 static int nwpserial_verify_port(struct uart_port *port,
-- 
1.8.0


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

* Re: [PATCH] tty: nwpserial: Pass correct pointer to free_irq()
  2013-05-20 17:07 [PATCH] tty: nwpserial: Pass correct pointer to free_irq() Lars-Peter Clausen
@ 2013-05-21  7:18 ` Benjamin Krill
  0 siblings, 0 replies; 2+ messages in thread
From: Benjamin Krill @ 2013-05-21  7:18 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: Greg Kroah-Hartman, Jiri Slaby, linux-serial, linux-kernel

Acked-off-by: Benjamin Krill <ben@codiert.org>

On Mon, 2013-05-20 at 19:07 +0200, Lars-Peter Clausen 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:
> 
> <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/tty/serial/nwpserial.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/tty/serial/nwpserial.c b/drivers/tty/serial/nwpserial.c
> index 77287c5..549c70a 100644
> --- a/drivers/tty/serial/nwpserial.c
> +++ b/drivers/tty/serial/nwpserial.c
> @@ -199,7 +199,7 @@ static void nwpserial_shutdown(struct uart_port *port)
>  	dcr_write(up->dcr_host, UART_IER, up->ier);
>  
>  	/* free irq */
> -	free_irq(up->port.irq, port);
> +	free_irq(up->port.irq, up);
>  }
>  
>  static int nwpserial_verify_port(struct uart_port *port,



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

end of thread, other threads:[~2013-05-21  7:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-20 17:07 [PATCH] tty: nwpserial: Pass correct pointer to free_irq() Lars-Peter Clausen
2013-05-21  7:18 ` Benjamin Krill

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.