Commit f0a4c596 authored by Tobin C. Harding's avatar Tobin C. Harding Committed by Greg Kroah-Hartman

staging: ks7010: reduce level of indentation

Checkpatch emits WARNING: Too many leading tabs - consider code
refactoring. One level of indentation may be removed by inverting an
if statement conditional (and returning if new conditional evaluates
to true). Code contains switch statement that also contains multiple
layers of indentation. Indentation may be reduced by breaking out of
the case statement in multiple places instead of guarding code with
if/else statements.

Invert conditional. Return original error code if new conditional
evaluates to true. Break out of case blocks instead of using
if/else. Do not modify program logic.
Signed-off-by: default avatarTobin C. Harding <me@tobin.cc>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f0b7d3a6
......@@ -1890,7 +1890,9 @@ static int ks_wlan_set_encode_ext(struct net_device *dev,
if (dwrq->flags & IW_ENCODE_DISABLED)
priv->wpa.key[index].key_len = 0;
if (enc) {
if (!enc)
return -EINVAL;
priv->wpa.key[index].ext_flags = enc->ext_flags;
if (enc->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) {
priv->wpa.txkey = index;
......@@ -1953,9 +1955,6 @@ static int ks_wlan_set_encode_ext(struct net_device *dev,
return -EINVAL;
}
priv->wpa.key[index].alg = enc->alg;
} else {
return -EINVAL;
}
if (commit) {
if (commit & SME_WEP_INDEX)
......@@ -2025,13 +2024,15 @@ static int ks_wlan_set_pmksa(struct net_device *dev,
if (!memcmp
("\x00\x00\x00\x00\x00\x00", pmk->bssid,
ETH_ALEN))
break;
break; /* loop */
}
memcpy(pmk->bssid, pmksa->bssid.sa_data, ETH_ALEN);
memcpy(pmk->pmkid, pmksa->pmkid, IW_PMKID_LEN);
list_add(&pmk->list, &priv->pmklist.head);
priv->pmklist.size++;
} else { /* search cache data */
break; /* case */
}
/* search cache data */
list_for_each(ptr, &priv->pmklist.head) {
pmk = list_entry(ptr, struct pmk_t, list);
if (!memcmp(pmksa->bssid.sa_data, pmk->bssid, ETH_ALEN)) { /* match address! list move to head. */
......@@ -2039,10 +2040,12 @@ static int ks_wlan_set_pmksa(struct net_device *dev,
IW_PMKID_LEN);
list_move(&pmk->list,
&priv->pmklist.head);
break;
break; /* list_for_each */
}
}
if (ptr == &priv->pmklist.head) { /* not find address. */
if (ptr != &priv->pmklist.head) /* not find address. */
break; /* case */
if (priv->pmklist.size <= PMK_LIST_MAX) { /* new cache data */
for (i = 0; i < PMK_LIST_MAX; i++) {
pmk = &priv->pmklist.pmk[i];
......@@ -2069,8 +2072,6 @@ static int ks_wlan_set_pmksa(struct net_device *dev,
list_move(&pmk->list,
&priv->pmklist.head);
}
}
}
break;
case IW_PMKSA_REMOVE:
if (list_empty(&priv->pmklist.head)) { /* list empty */
......
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