diff mbox series

net: systemport: free dev before on error path

Message ID 20210120044423.1704-1-bianpan2016@163.com (mailing list archive)
State Accepted
Delegated to: Netdev Maintainers
Headers show
Series net: systemport: free dev before on error path | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Guessed tree name to be net-next
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cc_maintainers success CCed 5 of 5 maintainers
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 12 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link
netdev/stable success Stable not CCed

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

Florian Fainelli Jan. 20, 2021, 5:07 a.m. UTC | #1
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>
Jakub Kicinski Jan. 20, 2021, 5:09 p.m. UTC | #2
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,