Skip to content

Commit

Permalink
tty: serial: altera_uart: Check for NULL platform_data in probe.
Browse files Browse the repository at this point in the history
Follow altera_jtag_uart.  This fixes a crash if there is a mistake in the DTS.

Signed-off-by: Yuriy Kozlov <ykozlov@ptcusa.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Yuriy Kozlov authored and Greg Kroah-Hartman committed Apr 9, 2012
1 parent ef37ea3 commit acede70
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/tty/serial/altera_uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -556,15 +556,15 @@ static int __devinit altera_uart_probe(struct platform_device *pdev)
res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (res_mem)
port->mapbase = res_mem->start;
else if (platp->mapbase)
else if (platp)
port->mapbase = platp->mapbase;
else
return -EINVAL;

res_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (res_irq)
port->irq = res_irq->start;
else if (platp->irq)
else if (platp)
port->irq = platp->irq;

/* Check platform data first so we can override device node data */
Expand Down

0 comments on commit acede70

Please sign in to comment.