Commit 55bd1499 authored by Huang Guobin's avatar Huang Guobin Committed by Kalle Valo
Browse files

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



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: 58871300 ("staging: wilc1000: avoid the use of 'wilc_wfi_mon' static variable")
Reported-by: default avatarHulk Robot <hulkci@huawei.com>
Signed-off-by: default avatarHuang Guobin <huangguobin4@huawei.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200917123019.206382-1-huangguobin4@huawei.com
parent 41650c45
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -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;