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>
struct uart_omap_port *up = dev_get_drvdata(dev);
struct omap_uart_port_info *pdata = dev->platform_data;
+ if (!up)
+ return -EINVAL;
+
/*
* When using 'no_console_suspend', the console UART must not be
* suspended. Since driver suspend is managed by runtime suspend,
uart_console(&up->port))
return -EBUSY;
- if (!up)
- return -EINVAL;
-
if (!pdata)
return 0;