linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: wilc1000: clean up resource in error path of init mon interface
@ 2020-09-17 12:30 Huang Guobin
  2020-09-21 13:02 ` Kalle Valo
  0 siblings, 1 reply; 2+ messages in thread
From: Huang Guobin @ 2020-09-17 12:30 UTC (permalink / raw)
  To: ajay.kathat, claudiu.beznea, kvalo, davem, kuba, gregkh
  Cc: linux-wireless, netdev, linux-kernel

The wilc_wfi_init_mon_int() forgets to clean up resource when
register_netdevice() failed. Add the missed call to fix it.
And the return value of netdev_priv can't be NULL, so remove
the unnecessary error handling.

Fixes: 588713006ea4 ("staging: wilc1000: avoid the use of 'wilc_wfi_mon' static variable")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Huang Guobin <huangguobin4@huawei.com>
---
 drivers/net/wireless/microchip/wilc1000/mon.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/wireless/microchip/wilc1000/mon.c b/drivers/net/wireless/microchip/wilc1000/mon.c
index 358ac8601333..b5a1b65c087c 100644
--- a/drivers/net/wireless/microchip/wilc1000/mon.c
+++ b/drivers/net/wireless/microchip/wilc1000/mon.c
@@ -235,11 +235,10 @@ struct net_device *wilc_wfi_init_mon_interface(struct wilc *wl,
 
 	if (register_netdevice(wl->monitor_dev)) {
 		netdev_err(real_dev, "register_netdevice failed\n");
+		free_netdev(wl->monitor_dev);
 		return NULL;
 	}
 	priv = netdev_priv(wl->monitor_dev);
-	if (!priv)
-		return NULL;
 
 	priv->real_ndev = real_dev;
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] net: wilc1000: clean up resource in error path of init mon interface
  2020-09-17 12:30 [PATCH net] net: wilc1000: clean up resource in error path of init mon interface Huang Guobin
@ 2020-09-21 13:02 ` Kalle Valo
  0 siblings, 0 replies; 2+ messages in thread
From: Kalle Valo @ 2020-09-21 13:02 UTC (permalink / raw)
  To: Huang Guobin
  Cc: ajay.kathat, claudiu.beznea, davem, kuba, gregkh, linux-wireless,
	netdev, linux-kernel

Huang Guobin <huangguobin4@huawei.com> wrote:

> The wilc_wfi_init_mon_int() forgets to clean up resource when
> register_netdevice() failed. Add the missed call to fix it.
> And the return value of netdev_priv can't be NULL, so remove
> the unnecessary error handling.
> 
> Fixes: 588713006ea4 ("staging: wilc1000: avoid the use of 'wilc_wfi_mon' static variable")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Huang Guobin <huangguobin4@huawei.com>

Patch applied to wireless-drivers-next.git, thanks.

55bd14997867 net: wilc1000: clean up resource in error path of init mon interface

-- 
https://patchwork.kernel.org/patch/11782369/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-09-21 13:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-17 12:30 [PATCH net] net: wilc1000: clean up resource in error path of init mon interface Huang Guobin
2020-09-21 13:02 ` Kalle Valo

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).