wl1271: set wl->vif only if add_interface succeeded.
set wl->vif to the newly created interface only after the firmware booted successfully. on the way - make the function flow more clear. Signed-off-by: Eliad Peller <eliad@wizery.com> Reviewed-by: Luciano Coelho <luciano.coelho@nokia.com> Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
This commit is contained in:
parent
f8d9802f66
commit
71125abdf0
1 changed files with 20 additions and 13 deletions
|
@ -950,18 +950,19 @@ static int wl1271_op_add_interface(struct ieee80211_hw *hw,
|
||||||
struct wiphy *wiphy = hw->wiphy;
|
struct wiphy *wiphy = hw->wiphy;
|
||||||
int retries = WL1271_BOOT_RETRIES;
|
int retries = WL1271_BOOT_RETRIES;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
bool booted = false;
|
||||||
|
|
||||||
wl1271_debug(DEBUG_MAC80211, "mac80211 add interface type %d mac %pM",
|
wl1271_debug(DEBUG_MAC80211, "mac80211 add interface type %d mac %pM",
|
||||||
vif->type, vif->addr);
|
vif->type, vif->addr);
|
||||||
|
|
||||||
mutex_lock(&wl->mutex);
|
mutex_lock(&wl->mutex);
|
||||||
if (wl->vif) {
|
if (wl->vif) {
|
||||||
|
wl1271_debug(DEBUG_MAC80211,
|
||||||
|
"multiple vifs are not supported yet");
|
||||||
ret = -EBUSY;
|
ret = -EBUSY;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
wl->vif = vif;
|
|
||||||
|
|
||||||
switch (vif->type) {
|
switch (vif->type) {
|
||||||
case NL80211_IFTYPE_STATION:
|
case NL80211_IFTYPE_STATION:
|
||||||
wl->bss_type = BSS_TYPE_STA_BSS;
|
wl->bss_type = BSS_TYPE_STA_BSS;
|
||||||
|
@ -999,15 +1000,8 @@ static int wl1271_op_add_interface(struct ieee80211_hw *hw,
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto irq_disable;
|
goto irq_disable;
|
||||||
|
|
||||||
wl->state = WL1271_STATE_ON;
|
booted = true;
|
||||||
wl1271_info("firmware booted (%s)", wl->chip.fw_ver);
|
break;
|
||||||
|
|
||||||
/* update hw/fw version info in wiphy struct */
|
|
||||||
wiphy->hw_version = wl->chip.id;
|
|
||||||
strncpy(wiphy->fw_version, wl->chip.fw_ver,
|
|
||||||
sizeof(wiphy->fw_version));
|
|
||||||
|
|
||||||
goto out;
|
|
||||||
|
|
||||||
irq_disable:
|
irq_disable:
|
||||||
wl1271_disable_interrupts(wl);
|
wl1271_disable_interrupts(wl);
|
||||||
|
@ -1025,8 +1019,21 @@ power_off:
|
||||||
wl1271_power_off(wl);
|
wl1271_power_off(wl);
|
||||||
}
|
}
|
||||||
|
|
||||||
wl1271_error("firmware boot failed despite %d retries",
|
if (!booted) {
|
||||||
WL1271_BOOT_RETRIES);
|
wl1271_error("firmware boot failed despite %d retries",
|
||||||
|
WL1271_BOOT_RETRIES);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
wl->vif = vif;
|
||||||
|
wl->state = WL1271_STATE_ON;
|
||||||
|
wl1271_info("firmware booted (%s)", wl->chip.fw_ver);
|
||||||
|
|
||||||
|
/* update hw/fw version info in wiphy struct */
|
||||||
|
wiphy->hw_version = wl->chip.id;
|
||||||
|
strncpy(wiphy->fw_version, wl->chip.fw_ver,
|
||||||
|
sizeof(wiphy->fw_version));
|
||||||
|
|
||||||
out:
|
out:
|
||||||
mutex_unlock(&wl->mutex);
|
mutex_unlock(&wl->mutex);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue