* [PATCH (net.git)] net:stmmac: fix memleak in the open method
@ 2013-07-04 4:18 Giuseppe CAVALLARO
2013-07-04 21:34 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Giuseppe CAVALLARO @ 2013-07-04 4:18 UTC (permalink / raw)
To: netdev; +Cc: Giuseppe Cavallaro
This patch is to fix a memory leak in the open method, it reviews error
conditions freeing the resources previously allocated and not freed in
cased of DMA failure.
Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index e9eab29..c047f0e 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1579,7 +1579,7 @@ static int stmmac_open(struct net_device *dev)
if (ret) {
pr_err("%s: Cannot attach to PHY (error: %d)\n",
__func__, ret);
- goto open_error;
+ goto phy_error;
}
}
@@ -1593,7 +1593,7 @@ static int stmmac_open(struct net_device *dev)
ret = stmmac_init_dma_engine(priv);
if (ret < 0) {
pr_err("%s: DMA initialization failed\n", __func__);
- goto open_error;
+ goto init_error;
}
/* Copy the MAC addr into the HW */
@@ -1612,7 +1612,7 @@ static int stmmac_open(struct net_device *dev)
if (unlikely(ret < 0)) {
pr_err("%s: ERROR: allocating the IRQ %d (error: %d)\n",
__func__, dev->irq, ret);
- goto open_error;
+ goto init_error;
}
/* Request the Wake IRQ in case of another line is used for WoL */
@@ -1622,7 +1622,7 @@ static int stmmac_open(struct net_device *dev)
if (unlikely(ret < 0)) {
pr_err("%s: ERROR: allocating the WoL IRQ %d (%d)\n",
__func__, priv->wol_irq, ret);
- goto open_error_wolirq;
+ goto wolirq_error;
}
}
@@ -1633,7 +1633,7 @@ static int stmmac_open(struct net_device *dev)
if (unlikely(ret < 0)) {
pr_err("%s: ERROR: allocating the LPI IRQ %d (%d)\n",
__func__, priv->lpi_irq, ret);
- goto open_error_lpiirq;
+ goto lpiirq_error;
}
}
@@ -1691,17 +1691,17 @@ static int stmmac_open(struct net_device *dev)
return 0;
-open_error_lpiirq:
+lpiirq_error:
if (priv->wol_irq != dev->irq)
free_irq(priv->wol_irq, dev);
-
-open_error_wolirq:
+wolirq_error:
free_irq(dev->irq, dev);
-open_error:
+init_error:
+ free_dma_desc_resources(priv);
if (priv->phydev)
phy_disconnect(priv->phydev);
-
+phy_error:
clk_disable_unprepare(priv->stmmac_clk);
return ret;
--
1.7.4.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH (net.git)] net:stmmac: fix memleak in the open method
2013-07-04 4:18 [PATCH (net.git)] net:stmmac: fix memleak in the open method Giuseppe CAVALLARO
@ 2013-07-04 21:34 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2013-07-04 21:34 UTC (permalink / raw)
To: peppe.cavallaro; +Cc: netdev
From: Giuseppe CAVALLARO <peppe.cavallaro@st.com>
Date: Thu, 4 Jul 2013 06:18:07 +0200
> This patch is to fix a memory leak in the open method, it reviews error
> conditions freeing the resources previously allocated and not freed in
> cased of DMA failure.
>
> Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-07-04 21:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-04 4:18 [PATCH (net.git)] net:stmmac: fix memleak in the open method Giuseppe CAVALLARO
2013-07-04 21:34 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).