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: 628c534ae7 ("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>
This commit is contained in:
Chris Brandt 2019-01-28 13:25:56 -05:00 committed by Greg Kroah-Hartman
parent 824d17c57b
commit 4d95987a32
1 changed files with 8 additions and 1 deletions

View File

@ -1921,7 +1921,7 @@ out_nomem:
static void sci_free_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 * 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)) if (unlikely(irq < 0))
continue; 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); free_irq(port->irqs[i], port);
kfree(port->irqstr[i]); kfree(port->irqstr[i]);