From: Sebastian Andrzej Siewior Date: Wed, 4 Dec 2013 19:52:49 +0000 (+0100) Subject: tty: serial: pch: don't crash if DMA enabled but not loaded X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=e41c0981213f39ecd421d8c1f7334cf04c2122e3;p=linux-beck.git tty: serial: pch: don't crash if DMA enabled but not loaded if the DMA driver isn't loaded "on time" then we crash in the irq handler: | pch_uart 0000:02:0a.4: pch_request_dma:dma_request_channel FAILS(Tx) | BUG: unable to handle kernel NULL pointer dereference at (null) | IP: [] pch_uart_interrupt+0x739/0x940 Signed-off-by: Sebastian Andrzej Siewior Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c index 0aa2b528ef3d..6bb7e90c8f22 100644 --- a/drivers/tty/serial/pch_uart.c +++ b/drivers/tty/serial/pch_uart.c @@ -1508,10 +1508,14 @@ static int pch_uart_verify_port(struct uart_port *port, __func__); return -EOPNOTSUPP; #endif - dev_info(priv->port.dev, "PCH UART : Use DMA Mode\n"); - if (!priv->use_dma) + if (!priv->use_dma) { pch_request_dma(port); - priv->use_dma = 1; + if (priv->chan_rx) + priv->use_dma = 1; + } + dev_info(priv->port.dev, "PCH UART: %s\n", + priv->use_dma ? + "Use DMA Mode" : "No DMA"); } return 0;