Skip to content

Commit

Permalink
hip04_eth: fix missing error handle for build_skb failed
Browse files Browse the repository at this point in the history
when build_skb failed, we should goto refill the buffer.

Signed-off-by: Weidong Wang <wangweidong1@huawei.com>
Acked-by: Ding Tainhong <dingtianhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
wangweidong authored and David S. Miller committed Jan 13, 2016
1 parent 1adbfc4 commit 701a0fd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/net/ethernet/hisilicon/hip04_eth.c
Original file line number Diff line number Diff line change
Expand Up @@ -500,8 +500,10 @@ static int hip04_rx_poll(struct napi_struct *napi, int budget)
while (cnt && !last) {
buf = priv->rx_buf[priv->rx_head];
skb = build_skb(buf, priv->rx_buf_size);
if (unlikely(!skb))
if (unlikely(!skb)) {
net_dbg_ratelimited("build_skb failed\n");
goto refill;
}

dma_unmap_single(&ndev->dev, priv->rx_phys[priv->rx_head],
RX_BUF_SIZE, DMA_FROM_DEVICE);
Expand All @@ -528,6 +530,7 @@ static int hip04_rx_poll(struct napi_struct *napi, int budget)
rx++;
}

refill:
buf = netdev_alloc_frag(priv->rx_buf_size);
if (!buf)
goto done;
Expand Down

0 comments on commit 701a0fd

Please sign in to comment.