Skip to content

Commit

Permalink
via-velocity: remove null pointer check on array tdinfo->skb_dma
Browse files Browse the repository at this point in the history
tdinfo->skb_dma is a 7 element array of dma_addr_t hence cannot be
null, so the pull pointer check on tdinfo->skb_dma  is redundant.
Remove it.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Francois Romieu <romieu@fr.zoreil.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Colin Ian King authored and David S. Miller committed Sep 10, 2016
1 parent 9438451 commit 46dfc23
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions drivers/net/ethernet/via/via-velocity.c
Original file line number Diff line number Diff line change
Expand Up @@ -1724,24 +1724,21 @@ static void velocity_free_tx_buf(struct velocity_info *vptr,
struct velocity_td_info *tdinfo, struct tx_desc *td)
{
struct sk_buff *skb = tdinfo->skb;
int i;

/*
* Don't unmap the pre-allocated tx_bufs
*/
if (tdinfo->skb_dma) {
int i;
for (i = 0; i < tdinfo->nskb_dma; i++) {
size_t pktlen = max_t(size_t, skb->len, ETH_ZLEN);

for (i = 0; i < tdinfo->nskb_dma; i++) {
size_t pktlen = max_t(size_t, skb->len, ETH_ZLEN);
/* For scatter-gather */
if (skb_shinfo(skb)->nr_frags > 0)
pktlen = max_t(size_t, pktlen,
td->td_buf[i].size & ~TD_QUEUE);

/* For scatter-gather */
if (skb_shinfo(skb)->nr_frags > 0)
pktlen = max_t(size_t, pktlen,
td->td_buf[i].size & ~TD_QUEUE);

dma_unmap_single(vptr->dev, tdinfo->skb_dma[i],
le16_to_cpu(pktlen), DMA_TO_DEVICE);
}
dma_unmap_single(vptr->dev, tdinfo->skb_dma[i],
le16_to_cpu(pktlen), DMA_TO_DEVICE);
}
dev_kfree_skb_irq(skb);
tdinfo->skb = NULL;
Expand Down

0 comments on commit 46dfc23

Please sign in to comment.