Skip to content

Commit

Permalink
net: systemport: free dev before on error path
Browse files Browse the repository at this point in the history
On the error path, it should goto the error handling label to free
allocated memory rather than directly return.

Fixes: 31bc72d ("net: systemport: fetch and use clock resources")
Signed-off-by: Pan Bian <bianpan2016@163.com>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Link: https://lore.kernel.org/r/20210120044423.1704-1-bianpan2016@163.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Pan Bian authored and Jakub Kicinski committed Jan 20, 2021
1 parent de658a1 commit 0c630a6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/net/ethernet/broadcom/bcmsysport.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 0c630a6

Please sign in to comment.