[mcs814x] nuport-mac: check dma_map_single address return values
authorFlorian Fainelli <florian@openwrt.org>
Wed, 8 Aug 2012 21:51:04 +0000 (21:51 +0000)
committerFlorian Fainelli <florian@openwrt.org>
Wed, 8 Aug 2012 21:51:04 +0000 (21:51 +0000)
SVN-Revision: 33067

target/linux/mcs814x/files-3.3/drivers/net/ethernet/mcs8140/nuport_mac.c

index 794987f..38dbe1e 100644 (file)
@@ -256,6 +256,8 @@ static int nuport_mac_start_tx_dma(struct nuport_mac_priv *priv,
 
        priv->tx_addr = dma_map_single(&priv->pdev->dev, skb->data,
                        skb->len, DMA_TO_DEVICE);
 
        priv->tx_addr = dma_map_single(&priv->pdev->dev, skb->data,
                        skb->len, DMA_TO_DEVICE);
+       if (!priv->tx_addr)
+               return -ENOMEM;
 
        /* enable enhanced mode */
        nuport_mac_writel(TX_DMA_ENH_ENABLE, TX_DMA_ENH);
 
        /* enable enhanced mode */
        nuport_mac_writel(TX_DMA_ENH_ENABLE, TX_DMA_ENH);
@@ -297,6 +299,8 @@ static int nuport_mac_start_rx_dma(struct nuport_mac_priv *priv,
 
        priv->rx_addr = dma_map_single(&priv->pdev->dev, skb->data,
                                RX_ALLOC_SIZE, DMA_FROM_DEVICE);
 
        priv->rx_addr = dma_map_single(&priv->pdev->dev, skb->data,
                                RX_ALLOC_SIZE, DMA_FROM_DEVICE);
+       if (!priv->rx_addr)
+               return -ENOMEM;
 
        nuport_mac_writel(priv->rx_addr, RX_BUFFER_ADDR);
        wmb();
 
        nuport_mac_writel(priv->rx_addr, RX_BUFFER_ADDR);
        wmb();