summaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial/pch_uart.c
diff options
context:
space:
mode:
authorFengguang Wu <fengguang.wu@intel.com>2012-07-28 20:43:57 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-08-16 12:10:16 -0700
commita92098a1cb7ec08c86d1b97d1831d8edaf26b1a2 (patch)
tree550ccfd69cdbe92d70bbf8a84c8f9ff394f1d7a5 /drivers/tty/serial/pch_uart.c
parent221ca778d677c5ec3a33385a3b6dd548174252a6 (diff)
pch_uart: check kzalloc result in dma_handle_tx()
Reported by coccinelle: drivers/tty/serial/pch_uart.c:979:1-14: alloc with no test, possible model on line 994 Signed-off-by: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/pch_uart.c')
-rw-r--r--drivers/tty/serial/pch_uart.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c
index 558ce8509a9..4cd6c238152 100644
--- a/drivers/tty/serial/pch_uart.c
+++ b/drivers/tty/serial/pch_uart.c
@@ -979,6 +979,10 @@ static unsigned int dma_handle_tx(struct eg20t_port *priv)
priv->tx_dma_use = 1;
priv->sg_tx_p = kzalloc(sizeof(struct scatterlist)*num, GFP_ATOMIC);
+ if (!priv->sg_tx_p) {
+ dev_err(priv->port.dev, "%s:kzalloc Failed\n", __func__);
+ return 0;
+ }
sg_init_table(priv->sg_tx_p, num); /* Initialize SG table */
sg = priv->sg_tx_p;