diff options
author | Florian Fainelli <f.fainelli@gmail.com> | 2014-10-31 15:51:34 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-11-01 15:13:56 -0400 |
commit | 3e8fc38c21d6908b394508a8c9bb220935fed4d2 (patch) | |
tree | cc5b2c29efc931d120c411f3a5cf2825eaf2c5df /drivers/net/ethernet/broadcom | |
parent | 437374735c0055433f8300ba59f8cf7214c58ad3 (diff) | |
download | blackbird-op-linux-3e8fc38c21d6908b394508a8c9bb220935fed4d2.tar.gz blackbird-op-linux-3e8fc38c21d6908b394508a8c9bb220935fed4d2.zip |
net: systemport: fix DMA allocation/freeing sizes
We should not be allocating a single byte of DMA coherent memory, but
instead a full-sized struct dma_desc (8 bytes).
Fixes: 80105befdb4b ("net: systemport: add Broadcom SYSTEMPORT Ethernet MAC driver")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/broadcom')
-rw-r--r-- | drivers/net/ethernet/broadcom/bcmsysport.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c index 3a6778a667f4..c81bf74685c0 100644 --- a/drivers/net/ethernet/broadcom/bcmsysport.c +++ b/drivers/net/ethernet/broadcom/bcmsysport.c @@ -1110,7 +1110,8 @@ static int bcm_sysport_init_tx_ring(struct bcm_sysport_priv *priv, /* We just need one DMA descriptor which is DMA-able, since writing to * the port will allocate a new descriptor in its internal linked-list */ - p = dma_zalloc_coherent(kdev, 1, &ring->desc_dma, GFP_KERNEL); + p = dma_zalloc_coherent(kdev, sizeof(struct dma_desc), &ring->desc_dma, + GFP_KERNEL); if (!p) { netif_err(priv, hw, priv->netdev, "DMA alloc failed\n"); return -ENOMEM; @@ -1183,7 +1184,8 @@ static void bcm_sysport_fini_tx_ring(struct bcm_sysport_priv *priv, ring->cbs = NULL; if (ring->desc_dma) { - dma_free_coherent(kdev, 1, ring->desc_cpu, ring->desc_dma); + dma_free_coherent(kdev, sizeof(struct dma_desc), + ring->desc_cpu, ring->desc_dma); ring->desc_dma = 0; } ring->size = 0; |