Skip to content

Commit

Permalink
serial: sh-sci: Fix for port types without BRI interrupts.
Browse files Browse the repository at this point in the history
In doing the evt2irq() + muxed vector conversion for various port types
it became apparent that some of the legacy port types will presently
error out due to the irq requesting logic attempting to acquire the
non-existent BRI IRQ. This adds some sanity checks to the request/free
path to ensure that non-existence of a source in itself is not an error.

This should restore functionality for legacy PORT_SCI ports.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
  • Loading branch information
Paul Mundt committed May 18, 2012
1 parent c1dbccc commit 0e8963d
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion drivers/tty/serial/sh-sci.c
Original file line number Diff line number Diff line change
Expand Up @@ -1052,9 +1052,17 @@ static int sci_request_irq(struct sci_port *port)
if (SCIx_IRQ_IS_MUXED(port)) {
i = SCIx_MUX_IRQ;
irq = up->irq;
} else
} else {
irq = port->cfg->irqs[i];

/*
* Certain port types won't support all of the
* available interrupt sources.
*/
if (unlikely(!irq))
continue;
}

desc = sci_irq_desc + i;
port->irqstr[j] = kasprintf(GFP_KERNEL, "%s:%s",
dev_name(up->dev), desc->desc);
Expand Down Expand Up @@ -1094,6 +1102,15 @@ static void sci_free_irq(struct sci_port *port)
* IRQ first.
*/
for (i = 0; i < SCIx_NR_IRQS; i++) {
unsigned int irq = port->cfg->irqs[i];

/*
* Certain port types won't support all of the available
* interrupt sources.
*/
if (unlikely(!irq))
continue;

free_irq(port->cfg->irqs[i], port);
kfree(port->irqstr[i]);

Expand Down

0 comments on commit 0e8963d

Please sign in to comment.