[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1473179450-7643-1-git-send-email-claudiu.beznea@gmail.com>
Date: Tue, 6 Sep 2016 19:30:50 +0300
From: Claudiu Beznea <claudiu.beznea@...il.com>
To: gregkh@...uxfoundation.org
Cc: devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org,
Claudiu Beznea <claudiu.beznea@...il.com>
Subject: [PATCH] Staging: wlan-ng: improve code aspect in p80211req_mibset_mibget()
This patch improves code aspect in p80211req_mibset_mibget() function
by removing accolades which followed case statements. To do so,
some data variable ware declared at the beginning of the
function and also pstr and key variables were initialized
only in the code which uses them.
Signed-off-by: Claudiu Beznea <claudiu.beznea@...il.com>
---
drivers/staging/wlan-ng/p80211req.c | 33 ++++++++++++++++++---------------
1 file changed, 18 insertions(+), 15 deletions(-)
diff --git a/drivers/staging/wlan-ng/p80211req.c b/drivers/staging/wlan-ng/p80211req.c
index 5c2b801..fe5bf4b 100644
--- a/drivers/staging/wlan-ng/p80211req.c
+++ b/drivers/staging/wlan-ng/p80211req.c
@@ -196,22 +196,26 @@ static void p80211req_mibset_mibget(wlandevice_t *wlandev,
int isget)
{
p80211itemd_t *mibitem = (p80211itemd_t *) mib_msg->mibattribute.data;
- p80211pstrd_t *pstr = (p80211pstrd_t *) mibitem->data;
- u8 *key = mibitem->data + sizeof(p80211pstrd_t);
+ p80211pstrd_t *pstr;
+ u8 *key;
+ u32 *data;
switch (mibitem->did) {
case DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey0:
case DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey1:
case DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey2:
case DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey3:
- if (!isget)
+ if (!isget) {
+ pstr = (struct p80211pstrd *)mibitem->data;
+ key = mibitem->data + sizeof(struct p80211pstrd);
wep_change_key(wlandev,
P80211DID_ITEM(mibitem->did) - 1,
key, pstr->len);
+ }
break;
- case DIDmib_dot11smt_dot11PrivacyTable_dot11WEPDefaultKeyID:{
- u32 *data = (u32 *) mibitem->data;
+ case DIDmib_dot11smt_dot11PrivacyTable_dot11WEPDefaultKeyID:
+ data = (u32 *)mibitem->data;
if (isget) {
*data = wlandev->hostwep & HOSTWEP_DEFAULTKEY_MASK;
@@ -219,21 +223,20 @@ static void p80211req_mibset_mibget(wlandevice_t *wlandev,
wlandev->hostwep &= ~(HOSTWEP_DEFAULTKEY_MASK);
wlandev->hostwep |= (*data & HOSTWEP_DEFAULTKEY_MASK);
}
- break;
- }
- case DIDmib_dot11smt_dot11PrivacyTable_dot11PrivacyInvoked:{
- u32 *data = (u32 *) mibitem->data;
+ break;
+
+ case DIDmib_dot11smt_dot11PrivacyTable_dot11PrivacyInvoked:
+ data = (u32 *)mibitem->data;
p80211req_handle_action(wlandev, data, isget,
HOSTWEP_PRIVACYINVOKED);
- break;
- }
- case DIDmib_dot11smt_dot11PrivacyTable_dot11ExcludeUnencrypted:{
- u32 *data = (u32 *) mibitem->data;
+ break;
+
+ case DIDmib_dot11smt_dot11PrivacyTable_dot11ExcludeUnencrypted:
+ data = (u32 *)mibitem->data;
p80211req_handle_action(wlandev, data, isget,
HOSTWEP_EXCLUDEUNENCRYPTED);
- break;
- }
+ break;
}
}
--
1.9.1
Powered by blists - more mailing lists