aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>2013-06-04 22:04:49 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-06-06 16:07:05 -0400
commit7f25301d83432efb0e7bb3fba288001a7bb03fdb (patch)
tree5f748f20f5f4bbd9f6a526f14e2ffe9485f060eb /drivers/tty
parentc36d6006d8a33ae3a0befb120c9878a634775786 (diff)
serial: omap: fix potential NULL pointer dereference in serial_omap_runtime_suspend()
The dereference to 'up' should be moved below the NULL test. Introduced by commit ddd85e225c8885b5e4419b0499ab27100e7c366a (serial: omap: prevent runtime PM for "no_console_suspend") Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Acked-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/serial/omap-serial.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index 1aaeca8727d4..156b5aaed95b 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -1613,6 +1613,9 @@ static int serial_omap_runtime_suspend(struct device *dev)
1613 struct uart_omap_port *up = dev_get_drvdata(dev); 1613 struct uart_omap_port *up = dev_get_drvdata(dev);
1614 struct omap_uart_port_info *pdata = dev->platform_data; 1614 struct omap_uart_port_info *pdata = dev->platform_data;
1615 1615
1616 if (!up)
1617 return -EINVAL;
1618
1616 /* 1619 /*
1617 * When using 'no_console_suspend', the console UART must not be 1620 * When using 'no_console_suspend', the console UART must not be
1618 * suspended. Since driver suspend is managed by runtime suspend, 1621 * suspended. Since driver suspend is managed by runtime suspend,
@@ -1623,9 +1626,6 @@ static int serial_omap_runtime_suspend(struct device *dev)
1623 uart_console(&up->port)) 1626 uart_console(&up->port))
1624 return -EBUSY; 1627 return -EBUSY;
1625 1628
1626 if (!up)
1627 return -EINVAL;
1628
1629 if (!pdata) 1629 if (!pdata)
1630 return 0; 1630 return 0;
1631 1631