Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit aa3933b8 authored by Ben Hutchings's avatar Ben Hutchings Committed by David S. Miller
Browse files

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: default avatarBen Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 740c7f31
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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)