* [PATCH] net: systemport: free dev before on error path
@ 2021-01-20 4:44 Pan Bian
2021-01-20 5:07 ` Florian Fainelli
0 siblings, 1 reply; 3+ messages in thread
From: Pan Bian @ 2021-01-20 4:44 UTC (permalink / raw)
To: Florian Fainelli, David S. Miller, Jakub Kicinski
Cc: bcm-kernel-feedback-list, netdev, linux-kernel, Pan Bian
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(-)
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] net: systemport: free dev before on error path
2021-01-20 4:44 [PATCH] net: systemport: free dev before on error path Pan Bian
@ 2021-01-20 5:07 ` Florian Fainelli
2021-01-20 17:09 ` Jakub Kicinski
0 siblings, 1 reply; 3+ messages in thread
From: Florian Fainelli @ 2021-01-20 5:07 UTC (permalink / raw)
To: Pan Bian, David S. Miller, Jakub Kicinski
Cc: bcm-kernel-feedback-list, netdev, linux-kernel
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>
--
Florian
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net: systemport: free dev before on error path
2021-01-20 5:07 ` Florian Fainelli
@ 2021-01-20 17:09 ` Jakub Kicinski
0 siblings, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2021-01-20 17:09 UTC (permalink / raw)
To: Florian Fainelli
Cc: Pan Bian, David S. Miller, bcm-kernel-feedback-list, netdev,
linux-kernel
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!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-01-20 17:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-20 4:44 [PATCH] net: systemport: free dev before on error path Pan Bian
2021-01-20 5:07 ` Florian Fainelli
2021-01-20 17:09 ` Jakub Kicinski
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).