summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSujith Manoharan <Sujith.Manoharan@atheros.com>2011-02-21 02:18:16 (GMT)
committerJohn W. Linville <linville@tuxdriver.com>2011-02-23 21:25:26 (GMT)
commitab77c70a15cdff106704a34254341c9a3a11dbc4 (patch)
treeaeb94d7c9e9b5c92a57f5b1817f4bcd349b2fc40
parent1057b7503908e351b399caeeca38f9ef5fcc766c (diff)
downloadlinux-fsl-qoriq-ab77c70a15cdff106704a34254341c9a3a11dbc4.tar.xz
ath9k_htc: Fix error handling in add_interface
Addition of a station might fail - handle this error properly by removing the VAP on the target. Also, bail out immediately if the max. no of interfaces has been reached. Signed-off-by: Sujith Manoharan <Sujith.Manoharan@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_main.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index 4ced5cd..ebc5dbf 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -1140,7 +1140,8 @@ static int ath9k_htc_add_interface(struct ieee80211_hw *hw,
if (priv->nvifs >= ATH9K_HTC_MAX_VIF) {
ret = -ENOBUFS;
- goto out;
+ mutex_unlock(&priv->mutex);
+ return ret;
}
ath9k_htc_ps_wakeup(priv);
@@ -1168,18 +1169,19 @@ static int ath9k_htc_add_interface(struct ieee80211_hw *hw,
if (ret)
goto out;
- priv->nvifs++;
-
/*
* We need a node in target to tx mgmt frames
* before association.
*/
ret = ath9k_htc_add_station(priv, vif, NULL);
- if (ret)
+ if (ret) {
+ WMI_CMD_BUF(WMI_VAP_REMOVE_CMDID, &hvif);
goto out;
+ }
priv->ah->opmode = vif->type;
priv->vif_slot |= (1 << avp->index);
+ priv->nvifs++;
priv->vif = vif;
ath_dbg(common, ATH_DBG_CONFIG,