Commit 573500db authored by Thomas Petazzoni's avatar Thomas Petazzoni Committed by David S. Miller

net: sh_eth: don't use NULL as "struct device" for the DMA mapping API

Using NULL as argument for the DMA mapping API is bogus, as the DMA
mapping API may use information from the "struct device" to perform
the DMA mapping operation. Therefore, pass the appropriate "struct
device".
Signed-off-by: default avatarThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Acked-by: default avatarSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Reviewed-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 22c1aed4
...@@ -1187,7 +1187,7 @@ static void sh_eth_ring_free(struct net_device *ndev) ...@@ -1187,7 +1187,7 @@ static void sh_eth_ring_free(struct net_device *ndev)
} }
} }
ringsize = sizeof(struct sh_eth_rxdesc) * mdp->num_rx_ring; ringsize = sizeof(struct sh_eth_rxdesc) * mdp->num_rx_ring;
dma_free_coherent(NULL, ringsize, mdp->rx_ring, dma_free_coherent(&mdp->pdev->dev, ringsize, mdp->rx_ring,
mdp->rx_desc_dma); mdp->rx_desc_dma);
mdp->rx_ring = NULL; mdp->rx_ring = NULL;
} }
...@@ -1204,7 +1204,7 @@ static void sh_eth_ring_free(struct net_device *ndev) ...@@ -1204,7 +1204,7 @@ static void sh_eth_ring_free(struct net_device *ndev)
sh_eth_tx_free(ndev, false); sh_eth_tx_free(ndev, false);
ringsize = sizeof(struct sh_eth_txdesc) * mdp->num_tx_ring; ringsize = sizeof(struct sh_eth_txdesc) * mdp->num_tx_ring;
dma_free_coherent(NULL, ringsize, mdp->tx_ring, dma_free_coherent(&mdp->pdev->dev, ringsize, mdp->tx_ring,
mdp->tx_desc_dma); mdp->tx_desc_dma);
mdp->tx_ring = NULL; mdp->tx_ring = NULL;
} }
...@@ -1324,8 +1324,8 @@ static int sh_eth_ring_init(struct net_device *ndev) ...@@ -1324,8 +1324,8 @@ static int sh_eth_ring_init(struct net_device *ndev)
/* Allocate all Rx descriptors. */ /* Allocate all Rx descriptors. */
rx_ringsize = sizeof(struct sh_eth_rxdesc) * mdp->num_rx_ring; rx_ringsize = sizeof(struct sh_eth_rxdesc) * mdp->num_rx_ring;
mdp->rx_ring = dma_alloc_coherent(NULL, rx_ringsize, &mdp->rx_desc_dma, mdp->rx_ring = dma_alloc_coherent(&mdp->pdev->dev, rx_ringsize,
GFP_KERNEL); &mdp->rx_desc_dma, GFP_KERNEL);
if (!mdp->rx_ring) if (!mdp->rx_ring)
goto ring_free; goto ring_free;
...@@ -1333,8 +1333,8 @@ static int sh_eth_ring_init(struct net_device *ndev) ...@@ -1333,8 +1333,8 @@ static int sh_eth_ring_init(struct net_device *ndev)
/* Allocate all Tx descriptors. */ /* Allocate all Tx descriptors. */
tx_ringsize = sizeof(struct sh_eth_txdesc) * mdp->num_tx_ring; tx_ringsize = sizeof(struct sh_eth_txdesc) * mdp->num_tx_ring;
mdp->tx_ring = dma_alloc_coherent(NULL, tx_ringsize, &mdp->tx_desc_dma, mdp->tx_ring = dma_alloc_coherent(&mdp->pdev->dev, tx_ringsize,
GFP_KERNEL); &mdp->tx_desc_dma, GFP_KERNEL);
if (!mdp->tx_ring) if (!mdp->tx_ring)
goto ring_free; goto ring_free;
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment