Skip to content

Commit a5f4313

Browse files
Cousson, Benoitgregkh
authored andcommitted
tty: serial: OMAP: Fix oops due to NULL pdata in DT boot
The following commit: be4b028 (tty: serial: OMAP: block idle while the UART is transferring data in PIO mode), is introducing an oops if OMAP is booted using device tree blob because the pdata will not be initialized. Check if pdata is set before de-referencing it. Signed-off-by: Benoit Cousson <[email protected]> Reviewed-by: Paul Walmsley <[email protected]> Cc: stable <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 079c953 commit a5f4313

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/tty/serial/omap-serial.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ static void serial_omap_stop_tx(struct uart_port *port)
159159
serial_out(up, UART_IER, up->ier);
160160
}
161161

162-
if (!up->use_dma && pdata->set_forceidle)
162+
if (!up->use_dma && pdata && pdata->set_forceidle)
163163
pdata->set_forceidle(up->pdev);
164164

165165
pm_runtime_mark_last_busy(&up->pdev->dev);
@@ -298,7 +298,7 @@ static void serial_omap_start_tx(struct uart_port *port)
298298
if (!up->use_dma) {
299299
pm_runtime_get_sync(&up->pdev->dev);
300300
serial_omap_enable_ier_thri(up);
301-
if (pdata->set_noidle)
301+
if (pdata && pdata->set_noidle)
302302
pdata->set_noidle(up->pdev);
303303
pm_runtime_mark_last_busy(&up->pdev->dev);
304304
pm_runtime_put_autosuspend(&up->pdev->dev);
@@ -1613,7 +1613,7 @@ static int serial_omap_runtime_resume(struct device *dev)
16131613
struct uart_omap_port *up = dev_get_drvdata(dev);
16141614
struct omap_uart_port_info *pdata = dev->platform_data;
16151615

1616-
if (up) {
1616+
if (up && pdata) {
16171617
if (pdata->get_context_loss_count) {
16181618
u32 loss_cnt = pdata->get_context_loss_count(dev);
16191619

0 commit comments

Comments
 (0)