Skip to content

Commit

Permalink
sh_eth: Check for DMA mapping errors on transmit
Browse files Browse the repository at this point in the history
dma_map_single() may fail if an IOMMU or swiotlb is in use, so
we need to check for this.

Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Ben Hutchings authored and David S. Miller committed Jan 27, 2015
1 parent 740c7f3 commit aa3933b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/net/ethernet/renesas/sh_eth.c
Original file line number Diff line number Diff line change
Expand Up @@ -2174,6 +2174,10 @@ static int sh_eth_start_xmit(struct sk_buff *skb, struct net_device *ndev)
skb->len + 2);
txdesc->addr = dma_map_single(&ndev->dev, skb->data, skb->len,
DMA_TO_DEVICE);
if (dma_mapping_error(&ndev->dev, txdesc->addr)) {
kfree_skb(skb);
return NETDEV_TX_OK;
}
txdesc->buffer_length = skb->len;

if (entry >= mdp->num_tx_ring - 1)
Expand Down

0 comments on commit aa3933b

Please sign in to comment.