Skip to contentSkip to conversation

staging: rtl8723bs: remove recurring counter increment

PATCH New Nikolay Kulikov 1 participant 1 message Feb 24 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: rtl8723bs: remove recurring counter increment

The code:

	cnt += in_ie[cnt + 1] + 2;   /* get next */

is in both the "if" and "else" branches.

Remove this repetition, which will simplify the code and improve readability.

---
 .../staging/rtl8723bs/core/rtw_ieee80211.c    | 23 ++++++++-----------
 1 file changed, 9 insertions(+), 14 deletions(-)
drivers/staging/rtl8723bs/core/rtw_ieee80211.c +9 -14
index 605c32fd2e88..e1077ca609bb 100644
@@ -589,10 +589,9 @@ int rtw_get_wapi_ie(u8 *in_ie, uint in_len, u8 *wapi_ie, u16 *wapi_len)
 			if (wapi_len)
 				*wapi_len = in_ie[cnt + 1] + 2;
 
-			cnt += in_ie[cnt + 1] + 2;  /* get next */
-		} else {
-			cnt += in_ie[cnt + 1] + 2;   /* get next */
 		}
+
+		cnt += in_ie[cnt + 1] + 2;   /* get next */
 	}
 
 	if (wapi_len)
@@ -620,18 +619,14 @@ void rtw_get_sec_ie(u8 *in_ie, uint in_len, u8 *rsn_ie, u16 *rsn_len, u8 *wpa_ie
 				memcpy(wpa_ie, &in_ie[cnt], in_ie[cnt + 1] + 2);
 
 			*wpa_len = in_ie[cnt + 1] + 2;
-			cnt += in_ie[cnt + 1] + 2;  /* get next */
-		} else {
-			if (authmode == WLAN_EID_RSN) {
-				if (rsn_ie)
-					memcpy(rsn_ie, &in_ie[cnt], in_ie[cnt + 1] + 2);
-
-				*rsn_len = in_ie[cnt + 1] + 2;
-				cnt += in_ie[cnt + 1] + 2;  /* get next */
-			} else {
-				cnt += in_ie[cnt + 1] + 2;   /* get next */
-			}
+		} else if (authmode == WLAN_EID_RSN) {
+			if (rsn_ie)
+				memcpy(rsn_ie, &in_ie[cnt], in_ie[cnt + 1] + 2);
+
+			*rsn_len = in_ie[cnt + 1] + 2;
 		}
+
+		cnt += in_ie[cnt + 1] + 2;   /* get next */
 	}
 }
 
Signature · 1 line
2.53.0