diff options
author | Johannes Berg <johannes.berg@intel.com> | 2012-03-05 14:24:22 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-03-06 15:16:08 -0500 |
commit | 40e4e6868c532b439754154d69a2837dbf9bd91e (patch) | |
tree | 695900549dc52ed495b7ccc567ea621859903a9f /drivers/net/wireless/iwlwifi | |
parent | 71cb99241d63b26a41c9cce6ed441bc30f90224a (diff) |
iwlwifi: simplify code in iwlagn_key_sta_id
Simplify the code by returning directly in the
error case and replacing the switch/if with a
single if statement.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn-sta.c | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-sta.c b/drivers/net/wireless/iwlwifi/iwl-agn-sta.c index f1298cd6a19a..3eb8fd4771b6 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-sta.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-sta.c | |||
@@ -1080,32 +1080,19 @@ static u8 iwlagn_key_sta_id(struct iwl_priv *priv, | |||
1080 | struct ieee80211_sta *sta) | 1080 | struct ieee80211_sta *sta) |
1081 | { | 1081 | { |
1082 | struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; | 1082 | struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; |
1083 | u8 sta_id = IWL_INVALID_STATION; | ||
1084 | 1083 | ||
1085 | if (sta) | 1084 | if (sta) |
1086 | sta_id = iwl_sta_id(sta); | 1085 | return iwl_sta_id(sta); |
1087 | 1086 | ||
1088 | /* | 1087 | /* |
1089 | * The device expects GTKs for station interfaces to be | 1088 | * The device expects GTKs for station interfaces to be |
1090 | * installed as GTKs for the AP station. If we have no | 1089 | * installed as GTKs for the AP station. If we have no |
1091 | * station ID, then use the ap_sta_id in that case. | 1090 | * station ID, then use the ap_sta_id in that case. |
1092 | */ | 1091 | */ |
1093 | if (!sta && vif && vif_priv->ctx) { | 1092 | if (vif->type == NL80211_IFTYPE_STATION && vif_priv->ctx) |
1094 | switch (vif->type) { | 1093 | return vif_priv->ctx->ap_sta_id; |
1095 | case NL80211_IFTYPE_STATION: | ||
1096 | sta_id = vif_priv->ctx->ap_sta_id; | ||
1097 | break; | ||
1098 | default: | ||
1099 | /* | ||
1100 | * In all other cases, the key will be | ||
1101 | * used either for TX only or is bound | ||
1102 | * to a station already. | ||
1103 | */ | ||
1104 | break; | ||
1105 | } | ||
1106 | } | ||
1107 | 1094 | ||
1108 | return sta_id; | 1095 | return IWL_INVALID_STATION; |
1109 | } | 1096 | } |
1110 | 1097 | ||
1111 | static int iwlagn_send_sta_key(struct iwl_priv *priv, | 1098 | static int iwlagn_send_sta_key(struct iwl_priv *priv, |