diff mbox series

[net] net: wilc1000: clean up resource in error path of init mon interface

Message ID 20200917123019.206382-1-huangguobin4@huawei.com
State New
Headers show
Series [net] net: wilc1000: clean up resource in error path of init mon interface | expand

Commit Message

Huang Guobin Sept. 17, 2020, 12:30 p.m. UTC
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(-)

Comments

Kalle Valo Sept. 21, 2020, 1:02 p.m. UTC | #1
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
diff mbox series

Patch

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;