[PATCH] net: systemport: free dev before on error path

Subsystems: broadcom systemport ethernet driver, networking drivers, the rest

STALE2032d LANDED

Landed in mainline as 0c630a66bf10 on 2021-01-20.

3 messages, 3 authors, 2021-01-20 · open the first message on its own page

[PATCH] net: systemport: free dev before on error path

From: Pan Bian <hidden>
Date: 2021-01-20 05:10:20

On the error path, it should goto the error handling label to free
allocated memory rather than directly return.

Fixes: 6328a126896e ("net: systemport: Manage Wake-on-LAN clock")
Signed-off-by: Pan Bian <redacted>
---
 drivers/net/ethernet/broadcom/bcmsysport.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index b1ae9eb8f247..0404aafd5ce5 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -2503,8 +2503,10 @@ static int bcm_sysport_probe(struct platform_device *pdev)
 	priv = netdev_priv(dev);
 
 	priv->clk = devm_clk_get_optional(&pdev->dev, "sw_sysport");
-	if (IS_ERR(priv->clk))
-		return PTR_ERR(priv->clk);
+	if (IS_ERR(priv->clk)) {
+		ret = PTR_ERR(priv->clk);
+		goto err_free_netdev;
+	}
 
 	/* Allocate number of TX rings */
 	priv->tx_rings = devm_kcalloc(&pdev->dev, txq,
-- 
2.17.1

Re: [PATCH] net: systemport: free dev before on error path

From: Florian Fainelli <f.fainelli@gmail.com>
Date: 2021-01-20 05:12:47


On 1/19/2021 8:44 PM, Pan Bian wrote:
On the error path, it should goto the error handling label to free
allocated memory rather than directly return.

Fixes: 6328a126896e ("net: systemport: Manage Wake-on-LAN clock")
Signed-off-by: Pan Bian <redacted>
The change is correct, but not the Fixes tag, it should be:

Fixes: 31bc72d97656 ("net: systemport: fetch and use clock resources")

Acked-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

Re: [PATCH] net: systemport: free dev before on error path

From: Jakub Kicinski <kuba@kernel.org>
Date: 2021-01-20 17:15:47

On Tue, 19 Jan 2021 21:07:10 -0800 Florian Fainelli wrote:
On 1/19/2021 8:44 PM, Pan Bian wrote:
quoted
On the error path, it should goto the error handling label to free
allocated memory rather than directly return.

Fixes: 6328a126896e ("net: systemport: Manage Wake-on-LAN clock")
Signed-off-by: Pan Bian <redacted>  
The change is correct, but not the Fixes tag, it should be:

Fixes: 31bc72d97656 ("net: systemport: fetch and use clock resources")

Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Applied, thank you!
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help