Commit 6df6f384 authored by Adham Abozaeid's avatar Adham Abozaeid Committed by Greg Kroah-Hartman

staging: wilc1000: check if device is initialzied before changing vif

When killing hostapd, the interface is closed which deinitializes the
device, then change virtual interface is called.
This change checks if the device is initialized before sending the
interface change command to the device
Signed-off-by: default avatarAdham Abozaeid <adham.abozaeid@microchip.com>
Link: https://lore.kernel.org/r/20191028184019.31194-1-adham.abozaeid@microchip.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 21c42244
...@@ -1413,6 +1413,8 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, ...@@ -1413,6 +1413,8 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
if (vif->iftype == WILC_AP_MODE || vif->iftype == WILC_GO_MODE) if (vif->iftype == WILC_AP_MODE || vif->iftype == WILC_GO_MODE)
wilc_wfi_deinit_mon_interface(wl, true); wilc_wfi_deinit_mon_interface(wl, true);
vif->iftype = WILC_STATION_MODE; vif->iftype = WILC_STATION_MODE;
if (wl->initialized)
wilc_set_operation_mode(vif, wilc_get_vif_idx(vif), wilc_set_operation_mode(vif, wilc_get_vif_idx(vif),
WILC_STATION_MODE, vif->idx); WILC_STATION_MODE, vif->idx);
...@@ -1426,6 +1428,8 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, ...@@ -1426,6 +1428,8 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
priv->wdev.iftype = type; priv->wdev.iftype = type;
vif->monitor_flag = 0; vif->monitor_flag = 0;
vif->iftype = WILC_CLIENT_MODE; vif->iftype = WILC_CLIENT_MODE;
if (wl->initialized)
wilc_set_operation_mode(vif, wilc_get_vif_idx(vif), wilc_set_operation_mode(vif, wilc_get_vif_idx(vif),
WILC_STATION_MODE, vif->idx); WILC_STATION_MODE, vif->idx);
break; break;
...@@ -1444,6 +1448,8 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, ...@@ -1444,6 +1448,8 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
dev->ieee80211_ptr->iftype = type; dev->ieee80211_ptr->iftype = type;
priv->wdev.iftype = type; priv->wdev.iftype = type;
vif->iftype = WILC_GO_MODE; vif->iftype = WILC_GO_MODE;
if (wl->initialized)
wilc_set_operation_mode(vif, wilc_get_vif_idx(vif), wilc_set_operation_mode(vif, wilc_get_vif_idx(vif),
WILC_AP_MODE, vif->idx); WILC_AP_MODE, vif->idx);
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment