Commit c287265b authored by Chris Brandt's avatar Chris Brandt Committed by Greg Kroah-Hartman

serial: sh-sci: Do not free irqs that have already been freed

commit 4d95987a upstream.

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: 628c534a ("serial: sh-sci: Improve support for separate TEI and DRI interrupts")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: default avatarChris Brandt <chris.brandt@renesas.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 57a3ef4d
......@@ -1921,7 +1921,7 @@ static int sci_request_irq(struct sci_port *port)
static void sci_free_irq(struct sci_port *port)
{
int i;
int i, j;
/*
* Intentionally in reverse order so we iterate over the muxed
......@@ -1937,6 +1937,13 @@ static void sci_free_irq(struct sci_port *port)
if (unlikely(irq < 0))
continue;
/* Check if already freed (irq was muxed) */
for (j = 0; j < i; j++)
if (port->irqs[j] == irq)
j = i + 1;
if (j > i)
continue;
free_irq(port->irqs[i], port);
kfree(port->irqstr[i]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment