diff mbox series

net: systemport: free dev before on error path

Message ID 20210120044423.1704-1-bianpan2016@163.com
State New
Headers show
Series net: systemport: free dev before on error path | expand

Commit Message

Pan Bian Jan. 20, 2021, 4:44 a.m. UTC
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 <bianpan2016@163.com>
---
 drivers/net/ethernet/broadcom/bcmsysport.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Jakub Kicinski Jan. 20, 2021, 5:09 p.m. UTC | #1
On Tue, 19 Jan 2021 21:07:10 -0800 Florian Fainelli wrote:
> 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 <bianpan2016@163.com>  
> 
> 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!
diff mbox series

Patch

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,