diff options
author | Ben Hutchings <ben.hutchings@codethink.co.uk> | 2015-01-26 19:49:47 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-01-27 03:18:53 -0500 |
commit | aa3933b87309c61b4fa4bb93c1ad4c3f08afb1b8 (patch) | |
tree | 57d6b303dfed3458372679a1105ae903a12181bb /drivers/net | |
parent | 740c7f31c094703cfb3902412e66e243eb24b707 (diff) |
sh_eth: Check for DMA mapping errors on transmit
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>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/ethernet/renesas/sh_eth.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c index 245166bbccfd..4a085da57188 100644 --- a/drivers/net/ethernet/renesas/sh_eth.c +++ b/drivers/net/ethernet/renesas/sh_eth.c | |||
@@ -2174,6 +2174,10 @@ static int sh_eth_start_xmit(struct sk_buff *skb, struct net_device *ndev) | |||
2174 | skb->len + 2); | 2174 | skb->len + 2); |
2175 | txdesc->addr = dma_map_single(&ndev->dev, skb->data, skb->len, | 2175 | txdesc->addr = dma_map_single(&ndev->dev, skb->data, skb->len, |
2176 | DMA_TO_DEVICE); | 2176 | DMA_TO_DEVICE); |
2177 | if (dma_mapping_error(&ndev->dev, txdesc->addr)) { | ||
2178 | kfree_skb(skb); | ||
2179 | return NETDEV_TX_OK; | ||
2180 | } | ||
2177 | txdesc->buffer_length = skb->len; | 2181 | txdesc->buffer_length = skb->len; |
2178 | 2182 | ||
2179 | if (entry >= mdp->num_tx_ring - 1) | 2183 | if (entry >= mdp->num_tx_ring - 1) |