mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
uart: fix NULL pointer deferencing in suspend/resume
PD#151229: driver defect clean up #235 #236 Change-Id: I59acc448a4ece1f385d0b6d602721d34ce60e02c Signed-off-by: Jiamin Ma <jiamin.ma@amlogic.com>
This commit is contained in:
@@ -1150,12 +1150,15 @@ static int meson_uart_resume(struct platform_device *pdev)
|
||||
u32 val;
|
||||
|
||||
port = platform_get_drvdata(pdev);
|
||||
if (port) {
|
||||
if (port->line == 0)
|
||||
return 0;
|
||||
uart_resume_port(&meson_uart_driver, port);
|
||||
if (!port) {
|
||||
dev_err(&pdev->dev, "port is NULL");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (port->line == 0)
|
||||
return 0;
|
||||
uart_resume_port(&meson_uart_driver, port);
|
||||
|
||||
val = readl(port->membase + AML_UART_CONTROL);
|
||||
if (!(val & AML_UART_TWO_WIRE_EN)) {
|
||||
val &= ~(0x1 << 31);
|
||||
@@ -1172,11 +1175,15 @@ static int meson_uart_suspend(struct platform_device *pdev,
|
||||
u32 val;
|
||||
|
||||
port = platform_get_drvdata(pdev);
|
||||
if (port) {
|
||||
if (port->line == 0)
|
||||
return 0;
|
||||
uart_suspend_port(&meson_uart_driver, port);
|
||||
if (!port) {
|
||||
dev_err(&pdev->dev, "port is NULL");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (port->line == 0)
|
||||
return 0;
|
||||
uart_suspend_port(&meson_uart_driver, port);
|
||||
|
||||
val = readl(port->membase + AML_UART_CONTROL);
|
||||
/* if rts/cts is open, pull up rts pin
|
||||
* when in suspend
|
||||
|
||||
Reference in New Issue
Block a user