Skip to content

Commit 4d95987

Browse files
seebegregkh
authored andcommitted
serial: sh-sci: Do not free irqs that have already been freed
Since IRQs might be muxed on some parts, we need to pay attention when we are freeing them. Otherwise we get the ugly WARNING "Trying to free already-free IRQ 20". Fixes: 628c534 ("serial: sh-sci: Improve support for separate TEI and DRI interrupts") Cc: stable <stable@vger.kernel.org> Signed-off-by: Chris Brandt <chris.brandt@renesas.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 824d17c commit 4d95987

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

drivers/tty/serial/sh-sci.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1921,7 +1921,7 @@ static int sci_request_irq(struct sci_port *port)
19211921

19221922
static void sci_free_irq(struct sci_port *port)
19231923
{
1924-
int i;
1924+
int i, j;
19251925

19261926
/*
19271927
* Intentionally in reverse order so we iterate over the muxed
@@ -1937,6 +1937,13 @@ static void sci_free_irq(struct sci_port *port)
19371937
if (unlikely(irq < 0))
19381938
continue;
19391939

1940+
/* Check if already freed (irq was muxed) */
1941+
for (j = 0; j < i; j++)
1942+
if (port->irqs[j] == irq)
1943+
j = i + 1;
1944+
if (j > i)
1945+
continue;
1946+
19401947
free_irq(port->irqs[i], port);
19411948
kfree(port->irqstr[i]);
19421949

0 commit comments

Comments
 (0)