Loading drivers/net/wan/fsl_ucc_hdlc.c +27 −28 Original line number Diff line number Diff line Loading @@ -143,7 +143,7 @@ static int uhdlc_init(struct ucc_hdlc_private *priv) if (!priv->rx_bd_base) { dev_err(priv->dev, "Cannot allocate MURAM memory for RxBDs\n"); ret = -ENOMEM; goto rxbd_alloc_error; goto free_uccf; } /* Alloc Tx BD */ Loading @@ -154,7 +154,7 @@ static int uhdlc_init(struct ucc_hdlc_private *priv) if (!priv->tx_bd_base) { dev_err(priv->dev, "Cannot allocate MURAM memory for TxBDs\n"); ret = -ENOMEM; goto txbd_alloc_error; goto free_rx_bd; } /* Alloc parameter ram for ucc hdlc */ Loading @@ -164,18 +164,18 @@ static int uhdlc_init(struct ucc_hdlc_private *priv) if (priv->ucc_pram_offset < 0) { dev_err(priv->dev, "Can not allocate MURAM for hdlc prameter.\n"); ret = -ENOMEM; goto pram_alloc_error; goto free_tx_bd; } priv->rx_skbuff = kzalloc(priv->rx_ring_size * sizeof(*priv->rx_skbuff), GFP_KERNEL); if (!priv->rx_skbuff) goto rx_skb_alloc_error; goto free_ucc_pram; priv->tx_skbuff = kzalloc(priv->tx_ring_size * sizeof(*priv->tx_skbuff), GFP_KERNEL); if (!priv->tx_skbuff) goto tx_skb_alloc_error; goto free_rx_skbuff; priv->skb_curtx = 0; priv->skb_dirtytx = 0; Loading @@ -200,14 +200,14 @@ static int uhdlc_init(struct ucc_hdlc_private *priv) if (riptr < 0) { dev_err(priv->dev, "Cannot allocate MURAM mem for Receive internal temp data pointer\n"); ret = -ENOMEM; goto riptr_alloc_error; goto free_tx_skbuff; } tiptr = qe_muram_alloc(32, 32); if (tiptr < 0) { dev_err(priv->dev, "Cannot allocate MURAM mem for Transmit internal temp data pointer\n"); ret = -ENOMEM; goto tiptr_alloc_error; goto free_riptr; } /* Set RIPTR, TIPTR */ Loading Loading @@ -247,7 +247,7 @@ static int uhdlc_init(struct ucc_hdlc_private *priv) if (!bd_buffer) { dev_err(priv->dev, "Could not allocate buffer descriptors\n"); ret = -ENOMEM; goto bd_alloc_error; goto free_tiptr; } memset(bd_buffer, 0, (RX_BD_RING_LEN + TX_BD_RING_LEN) Loading Loading @@ -283,25 +283,25 @@ static int uhdlc_init(struct ucc_hdlc_private *priv) return 0; bd_alloc_error: free_tiptr: qe_muram_free(tiptr); tiptr_alloc_error: free_riptr: qe_muram_free(riptr); riptr_alloc_error: free_tx_skbuff: kfree(priv->tx_skbuff); tx_skb_alloc_error: free_rx_skbuff: kfree(priv->rx_skbuff); rx_skb_alloc_error: free_ucc_pram: qe_muram_free(priv->ucc_pram_offset); pram_alloc_error: free_tx_bd: dma_free_coherent(priv->dev, TX_BD_RING_LEN * sizeof(struct qe_bd), priv->tx_bd_base, priv->dma_tx_bd); txbd_alloc_error: free_rx_bd: dma_free_coherent(priv->dev, RX_BD_RING_LEN * sizeof(struct qe_bd), priv->rx_bd_base, priv->dma_rx_bd); rxbd_alloc_error: free_uccf: ucc_fast_free(priv->uccf); return ret; Loading Loading @@ -1067,9 +1067,7 @@ static int ucc_hdlc_probe(struct platform_device *pdev) uhdlc_priv = kzalloc(sizeof(*uhdlc_priv), GFP_KERNEL); if (!uhdlc_priv) { ret = -ENOMEM; dev_err(&pdev->dev, "No mem to alloc hdlc private data\n"); goto err_alloc_priv; return -ENOMEM; } dev_set_drvdata(&pdev->dev, uhdlc_priv); Loading @@ -1087,25 +1085,25 @@ static int ucc_hdlc_probe(struct platform_device *pdev) if (!utdm) { ret = -ENOMEM; dev_err(&pdev->dev, "No mem to alloc ucc tdm data\n"); goto err_alloc_utdm; goto free_uhdlc_priv; } uhdlc_priv->utdm = utdm; ret = ucc_of_parse_tdm(np, utdm, ut_info); if (ret) goto err_miss_tsa_property; goto free_utdm; } ret = uhdlc_init(uhdlc_priv); if (ret) { dev_err(&pdev->dev, "Failed to init uhdlc\n"); goto err_hdlc_init; goto free_utdm; } dev = alloc_hdlcdev(uhdlc_priv); if (!dev) { ret = -ENOMEM; pr_err("ucc_hdlc: unable to allocate memory\n"); goto err_hdlc_init; goto undo_uhdlc_init; } uhdlc_priv->ndev = dev; Loading @@ -1119,18 +1117,19 @@ static int ucc_hdlc_probe(struct platform_device *pdev) ret = -ENOBUFS; pr_err("ucc_hdlc: unable to register hdlc device\n"); free_netdev(dev); goto err_hdlc_init; goto free_dev; } return 0; err_hdlc_init: err_miss_tsa_property: free_dev: free_netdev(dev); undo_uhdlc_init: free_utdm: if (uhdlc_priv->tsa) kfree(utdm); err_alloc_utdm: free_uhdlc_priv: kfree(uhdlc_priv); err_alloc_priv: return ret; } Loading Loading
drivers/net/wan/fsl_ucc_hdlc.c +27 −28 Original line number Diff line number Diff line Loading @@ -143,7 +143,7 @@ static int uhdlc_init(struct ucc_hdlc_private *priv) if (!priv->rx_bd_base) { dev_err(priv->dev, "Cannot allocate MURAM memory for RxBDs\n"); ret = -ENOMEM; goto rxbd_alloc_error; goto free_uccf; } /* Alloc Tx BD */ Loading @@ -154,7 +154,7 @@ static int uhdlc_init(struct ucc_hdlc_private *priv) if (!priv->tx_bd_base) { dev_err(priv->dev, "Cannot allocate MURAM memory for TxBDs\n"); ret = -ENOMEM; goto txbd_alloc_error; goto free_rx_bd; } /* Alloc parameter ram for ucc hdlc */ Loading @@ -164,18 +164,18 @@ static int uhdlc_init(struct ucc_hdlc_private *priv) if (priv->ucc_pram_offset < 0) { dev_err(priv->dev, "Can not allocate MURAM for hdlc prameter.\n"); ret = -ENOMEM; goto pram_alloc_error; goto free_tx_bd; } priv->rx_skbuff = kzalloc(priv->rx_ring_size * sizeof(*priv->rx_skbuff), GFP_KERNEL); if (!priv->rx_skbuff) goto rx_skb_alloc_error; goto free_ucc_pram; priv->tx_skbuff = kzalloc(priv->tx_ring_size * sizeof(*priv->tx_skbuff), GFP_KERNEL); if (!priv->tx_skbuff) goto tx_skb_alloc_error; goto free_rx_skbuff; priv->skb_curtx = 0; priv->skb_dirtytx = 0; Loading @@ -200,14 +200,14 @@ static int uhdlc_init(struct ucc_hdlc_private *priv) if (riptr < 0) { dev_err(priv->dev, "Cannot allocate MURAM mem for Receive internal temp data pointer\n"); ret = -ENOMEM; goto riptr_alloc_error; goto free_tx_skbuff; } tiptr = qe_muram_alloc(32, 32); if (tiptr < 0) { dev_err(priv->dev, "Cannot allocate MURAM mem for Transmit internal temp data pointer\n"); ret = -ENOMEM; goto tiptr_alloc_error; goto free_riptr; } /* Set RIPTR, TIPTR */ Loading Loading @@ -247,7 +247,7 @@ static int uhdlc_init(struct ucc_hdlc_private *priv) if (!bd_buffer) { dev_err(priv->dev, "Could not allocate buffer descriptors\n"); ret = -ENOMEM; goto bd_alloc_error; goto free_tiptr; } memset(bd_buffer, 0, (RX_BD_RING_LEN + TX_BD_RING_LEN) Loading Loading @@ -283,25 +283,25 @@ static int uhdlc_init(struct ucc_hdlc_private *priv) return 0; bd_alloc_error: free_tiptr: qe_muram_free(tiptr); tiptr_alloc_error: free_riptr: qe_muram_free(riptr); riptr_alloc_error: free_tx_skbuff: kfree(priv->tx_skbuff); tx_skb_alloc_error: free_rx_skbuff: kfree(priv->rx_skbuff); rx_skb_alloc_error: free_ucc_pram: qe_muram_free(priv->ucc_pram_offset); pram_alloc_error: free_tx_bd: dma_free_coherent(priv->dev, TX_BD_RING_LEN * sizeof(struct qe_bd), priv->tx_bd_base, priv->dma_tx_bd); txbd_alloc_error: free_rx_bd: dma_free_coherent(priv->dev, RX_BD_RING_LEN * sizeof(struct qe_bd), priv->rx_bd_base, priv->dma_rx_bd); rxbd_alloc_error: free_uccf: ucc_fast_free(priv->uccf); return ret; Loading Loading @@ -1067,9 +1067,7 @@ static int ucc_hdlc_probe(struct platform_device *pdev) uhdlc_priv = kzalloc(sizeof(*uhdlc_priv), GFP_KERNEL); if (!uhdlc_priv) { ret = -ENOMEM; dev_err(&pdev->dev, "No mem to alloc hdlc private data\n"); goto err_alloc_priv; return -ENOMEM; } dev_set_drvdata(&pdev->dev, uhdlc_priv); Loading @@ -1087,25 +1085,25 @@ static int ucc_hdlc_probe(struct platform_device *pdev) if (!utdm) { ret = -ENOMEM; dev_err(&pdev->dev, "No mem to alloc ucc tdm data\n"); goto err_alloc_utdm; goto free_uhdlc_priv; } uhdlc_priv->utdm = utdm; ret = ucc_of_parse_tdm(np, utdm, ut_info); if (ret) goto err_miss_tsa_property; goto free_utdm; } ret = uhdlc_init(uhdlc_priv); if (ret) { dev_err(&pdev->dev, "Failed to init uhdlc\n"); goto err_hdlc_init; goto free_utdm; } dev = alloc_hdlcdev(uhdlc_priv); if (!dev) { ret = -ENOMEM; pr_err("ucc_hdlc: unable to allocate memory\n"); goto err_hdlc_init; goto undo_uhdlc_init; } uhdlc_priv->ndev = dev; Loading @@ -1119,18 +1117,19 @@ static int ucc_hdlc_probe(struct platform_device *pdev) ret = -ENOBUFS; pr_err("ucc_hdlc: unable to register hdlc device\n"); free_netdev(dev); goto err_hdlc_init; goto free_dev; } return 0; err_hdlc_init: err_miss_tsa_property: free_dev: free_netdev(dev); undo_uhdlc_init: free_utdm: if (uhdlc_priv->tsa) kfree(utdm); err_alloc_utdm: free_uhdlc_priv: kfree(uhdlc_priv); err_alloc_priv: return ret; } Loading