diff options
author | Yuriy Kozlov <ykozlov@ptcusa.com> | 2012-03-29 03:55:27 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-04-09 13:30:39 -0400 |
commit | acede70d6561f2d042d9dbb153d9a3469479c0ed (patch) | |
tree | 6a458b7572de459a0c2ab9c82fc93b2ae351820f /drivers/tty | |
parent | ef37ea34cac19ef46173b26ee47a102f3b987d1e (diff) |
tty: serial: altera_uart: Check for NULL platform_data in probe.
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>
Diffstat (limited to 'drivers/tty')
-rw-r--r-- | drivers/tty/serial/altera_uart.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/tty/serial/altera_uart.c b/drivers/tty/serial/altera_uart.c index e7903751e058..1f0330915d5a 100644 --- a/drivers/tty/serial/altera_uart.c +++ b/drivers/tty/serial/altera_uart.c | |||
@@ -556,7 +556,7 @@ static int __devinit altera_uart_probe(struct platform_device *pdev) | |||
556 | res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 556 | res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
557 | if (res_mem) | 557 | if (res_mem) |
558 | port->mapbase = res_mem->start; | 558 | port->mapbase = res_mem->start; |
559 | else if (platp->mapbase) | 559 | else if (platp) |
560 | port->mapbase = platp->mapbase; | 560 | port->mapbase = platp->mapbase; |
561 | else | 561 | else |
562 | return -EINVAL; | 562 | return -EINVAL; |
@@ -564,7 +564,7 @@ static int __devinit altera_uart_probe(struct platform_device *pdev) | |||
564 | res_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); | 564 | res_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); |
565 | if (res_irq) | 565 | if (res_irq) |
566 | port->irq = res_irq->start; | 566 | port->irq = res_irq->start; |
567 | else if (platp->irq) | 567 | else if (platp) |
568 | port->irq = platp->irq; | 568 | port->irq = platp->irq; |
569 | 569 | ||
570 | /* Check platform data first so we can override device node data */ | 570 | /* Check platform data first so we can override device node data */ |