ethernet: Delete unnecessary checks before the macro call “dev_kfree_skb”
The dev_kfree_skb() function performs also input parameter validation. Thus the test around the shown calls is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
5477fccf9a
commit
399e06a517
|
@ -697,16 +697,14 @@ static void ni65_free_buffer(struct priv *p)
|
|||
for(i=0;i<TMDNUM;i++) {
|
||||
kfree(p->tmdbounce[i]);
|
||||
#ifdef XMT_VIA_SKB
|
||||
if(p->tmd_skb[i])
|
||||
dev_kfree_skb(p->tmd_skb[i]);
|
||||
dev_kfree_skb(p->tmd_skb[i]);
|
||||
#endif
|
||||
}
|
||||
|
||||
for(i=0;i<RMDNUM;i++)
|
||||
{
|
||||
#ifdef RCV_VIA_SKB
|
||||
if(p->recv_skb[i])
|
||||
dev_kfree_skb(p->recv_skb[i]);
|
||||
dev_kfree_skb(p->recv_skb[i]);
|
||||
#else
|
||||
kfree(p->recvbounce[i]);
|
||||
#endif
|
||||
|
|
|
@ -708,8 +708,7 @@ static int bcm_sysport_alloc_rx_bufs(struct bcm_sysport_priv *priv)
|
|||
for (i = 0; i < priv->num_rx_bds; i++) {
|
||||
cb = &priv->rx_cbs[i];
|
||||
skb = bcm_sysport_rx_refill(priv, cb);
|
||||
if (skb)
|
||||
dev_kfree_skb(skb);
|
||||
dev_kfree_skb(skb);
|
||||
if (!cb->skb)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
|
|
@ -2515,19 +2515,14 @@ static int bcmgenet_dma_teardown(struct bcmgenet_priv *priv)
|
|||
static void bcmgenet_fini_dma(struct bcmgenet_priv *priv)
|
||||
{
|
||||
struct netdev_queue *txq;
|
||||
struct sk_buff *skb;
|
||||
struct enet_cb *cb;
|
||||
int i;
|
||||
|
||||
bcmgenet_fini_rx_napi(priv);
|
||||
bcmgenet_fini_tx_napi(priv);
|
||||
|
||||
for (i = 0; i < priv->num_tx_bds; i++) {
|
||||
cb = priv->tx_cbs + i;
|
||||
skb = bcmgenet_free_tx_cb(&priv->pdev->dev, cb);
|
||||
if (skb)
|
||||
dev_kfree_skb(skb);
|
||||
}
|
||||
for (i = 0; i < priv->num_tx_bds; i++)
|
||||
dev_kfree_skb(bcmgenet_free_tx_cb(&priv->pdev->dev,
|
||||
priv->tx_cbs + i));
|
||||
|
||||
for (i = 0; i < priv->hw_params->tx_queues; i++) {
|
||||
txq = netdev_get_tx_queue(priv->dev, priv->tx_rings[i].queue);
|
||||
|
|
|
@ -2005,8 +2005,7 @@ static void free_skb_rx_queue(struct gfar_priv_rx_q *rx_queue)
|
|||
|
||||
struct rxbd8 *rxbdp = rx_queue->rx_bd_base;
|
||||
|
||||
if (rx_queue->skb)
|
||||
dev_kfree_skb(rx_queue->skb);
|
||||
dev_kfree_skb(rx_queue->skb);
|
||||
|
||||
for (i = 0; i < rx_queue->rx_ring_size; i++) {
|
||||
struct gfar_rx_buff *rxb = &rx_queue->rx_buff[i];
|
||||
|
|
|
@ -1577,20 +1577,16 @@ static int ehea_clean_portres(struct ehea_port *port, struct ehea_port_res *pr)
|
|||
ehea_destroy_eq(pr->eq);
|
||||
|
||||
for (i = 0; i < pr->rq1_skba.len; i++)
|
||||
if (pr->rq1_skba.arr[i])
|
||||
dev_kfree_skb(pr->rq1_skba.arr[i]);
|
||||
dev_kfree_skb(pr->rq1_skba.arr[i]);
|
||||
|
||||
for (i = 0; i < pr->rq2_skba.len; i++)
|
||||
if (pr->rq2_skba.arr[i])
|
||||
dev_kfree_skb(pr->rq2_skba.arr[i]);
|
||||
dev_kfree_skb(pr->rq2_skba.arr[i]);
|
||||
|
||||
for (i = 0; i < pr->rq3_skba.len; i++)
|
||||
if (pr->rq3_skba.arr[i])
|
||||
dev_kfree_skb(pr->rq3_skba.arr[i]);
|
||||
dev_kfree_skb(pr->rq3_skba.arr[i]);
|
||||
|
||||
for (i = 0; i < pr->sq_skba.len; i++)
|
||||
if (pr->sq_skba.arr[i])
|
||||
dev_kfree_skb(pr->sq_skba.arr[i]);
|
||||
dev_kfree_skb(pr->sq_skba.arr[i]);
|
||||
|
||||
vfree(pr->rq1_skba.arr);
|
||||
vfree(pr->rq2_skba.arr);
|
||||
|
|
|
@ -937,8 +937,7 @@ static void e1000_free_desc_rings(struct e1000_adapter *adapter)
|
|||
txdr->buffer_info[i].dma,
|
||||
txdr->buffer_info[i].length,
|
||||
DMA_TO_DEVICE);
|
||||
if (txdr->buffer_info[i].skb)
|
||||
dev_kfree_skb(txdr->buffer_info[i].skb);
|
||||
dev_kfree_skb(txdr->buffer_info[i].skb);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4175,8 +4175,7 @@ static bool e1000_clean_jumbo_rx_irq(struct e1000_adapter *adapter,
|
|||
/* an error means any chain goes out the window
|
||||
* too
|
||||
*/
|
||||
if (rx_ring->rx_skb_top)
|
||||
dev_kfree_skb(rx_ring->rx_skb_top);
|
||||
dev_kfree_skb(rx_ring->rx_skb_top);
|
||||
rx_ring->rx_skb_top = NULL;
|
||||
goto next_desc;
|
||||
}
|
||||
|
|
|
@ -1126,8 +1126,7 @@ static void e1000_free_desc_rings(struct e1000_adapter *adapter)
|
|||
buffer_info->dma,
|
||||
buffer_info->length,
|
||||
DMA_TO_DEVICE);
|
||||
if (buffer_info->skb)
|
||||
dev_kfree_skb(buffer_info->skb);
|
||||
dev_kfree_skb(buffer_info->skb);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1139,8 +1138,7 @@ static void e1000_free_desc_rings(struct e1000_adapter *adapter)
|
|||
dma_unmap_single(&pdev->dev,
|
||||
buffer_info->dma,
|
||||
2048, DMA_FROM_DEVICE);
|
||||
if (buffer_info->skb)
|
||||
dev_kfree_skb(buffer_info->skb);
|
||||
dev_kfree_skb(buffer_info->skb);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -253,8 +253,7 @@ static void fm10k_clean_rx_ring(struct fm10k_ring *rx_ring)
|
|||
if (!rx_ring->rx_buffer)
|
||||
return;
|
||||
|
||||
if (rx_ring->skb)
|
||||
dev_kfree_skb(rx_ring->skb);
|
||||
dev_kfree_skb(rx_ring->skb);
|
||||
rx_ring->skb = NULL;
|
||||
|
||||
/* Free all the Rx ring sk_buffs */
|
||||
|
|
|
@ -4731,8 +4731,7 @@ static void igb_clean_rx_ring(struct igb_ring *rx_ring)
|
|||
{
|
||||
u16 i = rx_ring->next_to_clean;
|
||||
|
||||
if (rx_ring->skb)
|
||||
dev_kfree_skb(rx_ring->skb);
|
||||
dev_kfree_skb(rx_ring->skb);
|
||||
rx_ring->skb = NULL;
|
||||
|
||||
/* Free all the Rx ring sk_buffs */
|
||||
|
|
|
@ -352,8 +352,7 @@ static void igc_clean_rx_ring(struct igc_ring *rx_ring)
|
|||
{
|
||||
u16 i = rx_ring->next_to_clean;
|
||||
|
||||
if (rx_ring->skb)
|
||||
dev_kfree_skb(rx_ring->skb);
|
||||
dev_kfree_skb(rx_ring->skb);
|
||||
rx_ring->skb = NULL;
|
||||
|
||||
/* Free all the Rx ring sk_buffs */
|
||||
|
|
|
@ -580,9 +580,7 @@ out:
|
|||
dma_unmap_single(adapter->dev, sg_dma_address(sg),
|
||||
DMA_BUFFER_SIZE, DMA_FROM_DEVICE);
|
||||
sg_dma_address(sg) = 0;
|
||||
if (ctl->skb)
|
||||
dev_kfree_skb(ctl->skb);
|
||||
|
||||
dev_kfree_skb(ctl->skb);
|
||||
ctl->skb = NULL;
|
||||
|
||||
printk(KERN_ERR DRV_NAME": Failed to start RX DMA: %d\n", err);
|
||||
|
|
|
@ -963,8 +963,7 @@ void lan743x_ptp_close(struct lan743x_adapter *adapter)
|
|||
index++) {
|
||||
struct sk_buff *skb = ptp->tx_ts_skb_queue[index];
|
||||
|
||||
if (skb)
|
||||
dev_kfree_skb(skb);
|
||||
dev_kfree_skb(skb);
|
||||
ptp->tx_ts_skb_queue[index] = NULL;
|
||||
ptp->tx_ts_seconds_queue[index] = 0;
|
||||
ptp->tx_ts_nseconds_queue[index] = 0;
|
||||
|
|
|
@ -1258,8 +1258,7 @@ static int yellowfin_close(struct net_device *dev)
|
|||
yp->rx_skbuff[i] = NULL;
|
||||
}
|
||||
for (i = 0; i < TX_RING_SIZE; i++) {
|
||||
if (yp->tx_skbuff[i])
|
||||
dev_kfree_skb(yp->tx_skbuff[i]);
|
||||
dev_kfree_skb(yp->tx_skbuff[i]);
|
||||
yp->tx_skbuff[i] = NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -837,8 +837,7 @@ qcaspi_netdev_uninit(struct net_device *dev)
|
|||
|
||||
kfree(qca->rx_buffer);
|
||||
qca->buffer_size = 0;
|
||||
if (qca->rx_skb)
|
||||
dev_kfree_skb(qca->rx_skb);
|
||||
dev_kfree_skb(qca->rx_skb);
|
||||
}
|
||||
|
||||
static const struct net_device_ops qcaspi_netdev_ops = {
|
||||
|
|
|
@ -285,8 +285,7 @@ static void qcauart_netdev_uninit(struct net_device *dev)
|
|||
{
|
||||
struct qcauart *qca = netdev_priv(dev);
|
||||
|
||||
if (qca->rx_skb)
|
||||
dev_kfree_skb(qca->rx_skb);
|
||||
dev_kfree_skb(qca->rx_skb);
|
||||
}
|
||||
|
||||
static const struct net_device_ops qcauart_netdev_ops = {
|
||||
|
|
|
@ -247,8 +247,7 @@ static void meth_free_tx_ring(struct meth_private *priv)
|
|||
|
||||
/* Remove any pending skb */
|
||||
for (i = 0; i < TX_RING_ENTRIES; i++) {
|
||||
if (priv->tx_skbs[i])
|
||||
dev_kfree_skb(priv->tx_skbs[i]);
|
||||
dev_kfree_skb(priv->tx_skbs[i]);
|
||||
priv->tx_skbs[i] = NULL;
|
||||
}
|
||||
dma_free_coherent(&priv->pdev->dev, TX_RING_BUFFER_SIZE, priv->tx_ring,
|
||||
|
|
|
@ -378,8 +378,7 @@ static void smc_shutdown(struct net_device *dev)
|
|||
pending_skb = lp->pending_tx_skb;
|
||||
lp->pending_tx_skb = NULL;
|
||||
spin_unlock_irq(&lp->lock);
|
||||
if (pending_skb)
|
||||
dev_kfree_skb(pending_skb);
|
||||
dev_kfree_skb(pending_skb);
|
||||
|
||||
/* and tell the card to stay away from that nasty outside world */
|
||||
SMC_SELECT_BANK(lp, 0);
|
||||
|
|
|
@ -3519,8 +3519,7 @@ read_again:
|
|||
if (unlikely(error && (status & rx_not_ls)))
|
||||
goto read_again;
|
||||
if (unlikely(error)) {
|
||||
if (skb)
|
||||
dev_kfree_skb(skb);
|
||||
dev_kfree_skb(skb);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -1532,8 +1532,7 @@ out_dropped:
|
|||
else if (port)
|
||||
del_timer(&port->clean_timer);
|
||||
rcu_read_unlock();
|
||||
if (skb)
|
||||
dev_kfree_skb(skb);
|
||||
dev_kfree_skb(skb);
|
||||
vnet_free_skbs(freeskbs);
|
||||
dev->stats.tx_dropped++;
|
||||
return NETDEV_TX_OK;
|
||||
|
|
Loading…
Reference in New Issue