From: Yuriy Kozlov Date: Thu, 29 Mar 2012 07:55:27 +0000 (+0200) Subject: tty: serial: altera_uart: Check for NULL platform_data in probe. X-Git-Tag: firefly_0821_release~7541^2~1388 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=a2646264907ed038852b3ffdea9901cd5ea2305f;p=firefly-linux-kernel-4.4.55.git tty: serial: altera_uart: Check for NULL platform_data in probe. commit acede70d6561f2d042d9dbb153d9a3469479c0ed upstream. Follow altera_jtag_uart. This fixes a crash if there is a mistake in the DTS. Signed-off-by: Yuriy Kozlov Signed-off-by: Tobias Klauser Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/tty/serial/altera_uart.c b/drivers/tty/serial/altera_uart.c index 50bc5a5ac653..37db1d5898e0 100644 --- a/drivers/tty/serial/altera_uart.c +++ b/drivers/tty/serial/altera_uart.c @@ -555,7 +555,7 @@ 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; @@ -563,7 +563,7 @@ static int __devinit altera_uart_probe(struct platform_device *pdev) 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 */