Skip to content

Commit

Permalink
pch_uart: check kzalloc result in dma_handle_tx()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Fengguang Wu authored and Greg Kroah-Hartman committed Aug 16, 2012
1 parent 221ca77 commit a92098a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/tty/serial/pch_uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a92098a

Please sign in to comment.