Commit f7d85556 authored by Byungho An's avatar Byungho An Committed by David S. Miller

net: sxgbe: Fix waring for double kfree()

This patch fixes double kfree() calls at init_rx_ring() because
it causes static checker warning.
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarByungho An <bh74.an@samsung.com>
Signed-off-by: default avatarKukjin Kim <kgene@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1c1832c7
...@@ -474,13 +474,19 @@ static int init_rx_ring(struct net_device *dev, u8 queue_no, ...@@ -474,13 +474,19 @@ static int init_rx_ring(struct net_device *dev, u8 queue_no,
/* allocate memory for RX skbuff array */ /* allocate memory for RX skbuff array */
rx_ring->rx_skbuff_dma = kmalloc_array(rx_rsize, rx_ring->rx_skbuff_dma = kmalloc_array(rx_rsize,
sizeof(dma_addr_t), GFP_KERNEL); sizeof(dma_addr_t), GFP_KERNEL);
if (rx_ring->rx_skbuff_dma == NULL) if (!rx_ring->rx_skbuff_dma) {
goto dmamem_err; dma_free_coherent(priv->device,
rx_rsize * sizeof(struct sxgbe_rx_norm_desc),
rx_ring->dma_rx, rx_ring->dma_rx_phy);
goto error;
}
rx_ring->rx_skbuff = kmalloc_array(rx_rsize, rx_ring->rx_skbuff = kmalloc_array(rx_rsize,
sizeof(struct sk_buff *), GFP_KERNEL); sizeof(struct sk_buff *), GFP_KERNEL);
if (rx_ring->rx_skbuff == NULL) if (!rx_ring->rx_skbuff) {
goto rxbuff_err; kfree(rx_ring->rx_skbuff_dma);
goto error;
}
/* initialise the buffers */ /* initialise the buffers */
for (desc_index = 0; desc_index < rx_rsize; desc_index++) { for (desc_index = 0; desc_index < rx_rsize; desc_index++) {
...@@ -502,13 +508,6 @@ static int init_rx_ring(struct net_device *dev, u8 queue_no, ...@@ -502,13 +508,6 @@ static int init_rx_ring(struct net_device *dev, u8 queue_no,
err_init_rx_buffers: err_init_rx_buffers:
while (--desc_index >= 0) while (--desc_index >= 0)
free_rx_ring(priv->device, rx_ring, desc_index); free_rx_ring(priv->device, rx_ring, desc_index);
kfree(rx_ring->rx_skbuff);
rxbuff_err:
kfree(rx_ring->rx_skbuff_dma);
dmamem_err:
dma_free_coherent(priv->device,
rx_rsize * sizeof(struct sxgbe_rx_norm_desc),
rx_ring->dma_rx, rx_ring->dma_rx_phy);
error: error:
return -ENOMEM; return -ENOMEM;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment