Commit 5b8aad93 authored by Holger Brunck's avatar Holger Brunck Committed by David S. Miller

net/wan/fsl_ucc_hdlc: fix incorrect memory allocation

We need space for the struct qe_bd and not for a pointer to this struct.
Signed-off-by: default avatarHolger Brunck <holger.brunck@keymile.com>
Cc: Zhao Qiang <qiang.zhao@nxp.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 10515db5
...@@ -136,7 +136,7 @@ static int uhdlc_init(struct ucc_hdlc_private *priv) ...@@ -136,7 +136,7 @@ static int uhdlc_init(struct ucc_hdlc_private *priv)
priv->tx_ring_size = TX_BD_RING_LEN; priv->tx_ring_size = TX_BD_RING_LEN;
/* Alloc Rx BD */ /* Alloc Rx BD */
priv->rx_bd_base = dma_alloc_coherent(priv->dev, priv->rx_bd_base = dma_alloc_coherent(priv->dev,
RX_BD_RING_LEN * sizeof(struct qe_bd *), RX_BD_RING_LEN * sizeof(struct qe_bd),
&priv->dma_rx_bd, GFP_KERNEL); &priv->dma_rx_bd, GFP_KERNEL);
if (!priv->rx_bd_base) { if (!priv->rx_bd_base) {
...@@ -147,7 +147,7 @@ static int uhdlc_init(struct ucc_hdlc_private *priv) ...@@ -147,7 +147,7 @@ static int uhdlc_init(struct ucc_hdlc_private *priv)
/* Alloc Tx BD */ /* Alloc Tx BD */
priv->tx_bd_base = dma_alloc_coherent(priv->dev, priv->tx_bd_base = dma_alloc_coherent(priv->dev,
TX_BD_RING_LEN * sizeof(struct qe_bd *), TX_BD_RING_LEN * sizeof(struct qe_bd),
&priv->dma_tx_bd, GFP_KERNEL); &priv->dma_tx_bd, GFP_KERNEL);
if (!priv->tx_bd_base) { if (!priv->tx_bd_base) {
...@@ -294,11 +294,11 @@ static int uhdlc_init(struct ucc_hdlc_private *priv) ...@@ -294,11 +294,11 @@ static int uhdlc_init(struct ucc_hdlc_private *priv)
qe_muram_free(priv->ucc_pram_offset); qe_muram_free(priv->ucc_pram_offset);
free_tx_bd: free_tx_bd:
dma_free_coherent(priv->dev, dma_free_coherent(priv->dev,
TX_BD_RING_LEN * sizeof(struct qe_bd *), TX_BD_RING_LEN * sizeof(struct qe_bd),
priv->tx_bd_base, priv->dma_tx_bd); priv->tx_bd_base, priv->dma_tx_bd);
free_rx_bd: free_rx_bd:
dma_free_coherent(priv->dev, dma_free_coherent(priv->dev,
RX_BD_RING_LEN * sizeof(struct qe_bd *), RX_BD_RING_LEN * sizeof(struct qe_bd),
priv->rx_bd_base, priv->dma_rx_bd); priv->rx_bd_base, priv->dma_rx_bd);
free_uccf: free_uccf:
ucc_fast_free(priv->uccf); ucc_fast_free(priv->uccf);
...@@ -656,7 +656,7 @@ static void uhdlc_memclean(struct ucc_hdlc_private *priv) ...@@ -656,7 +656,7 @@ static void uhdlc_memclean(struct ucc_hdlc_private *priv)
if (priv->rx_bd_base) { if (priv->rx_bd_base) {
dma_free_coherent(priv->dev, dma_free_coherent(priv->dev,
RX_BD_RING_LEN * sizeof(struct qe_bd *), RX_BD_RING_LEN * sizeof(struct qe_bd),
priv->rx_bd_base, priv->dma_rx_bd); priv->rx_bd_base, priv->dma_rx_bd);
priv->rx_bd_base = NULL; priv->rx_bd_base = NULL;
...@@ -665,7 +665,7 @@ static void uhdlc_memclean(struct ucc_hdlc_private *priv) ...@@ -665,7 +665,7 @@ static void uhdlc_memclean(struct ucc_hdlc_private *priv)
if (priv->tx_bd_base) { if (priv->tx_bd_base) {
dma_free_coherent(priv->dev, dma_free_coherent(priv->dev,
TX_BD_RING_LEN * sizeof(struct qe_bd *), TX_BD_RING_LEN * sizeof(struct qe_bd),
priv->tx_bd_base, priv->dma_tx_bd); priv->tx_bd_base, priv->dma_tx_bd);
priv->tx_bd_base = NULL; priv->tx_bd_base = NULL;
......
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