staging: rtl8723bs: remove recurring counter increment
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.
Signed-off-by Nikolay Kulikov <[email protected]>
--- .../staging/rtl8723bs/core/rtw_ieee80211.c | 23 ++++++++----------- 1 file changed, 9 insertions(+), 14 deletions(-)
drivers/staging/rtl8723bs/core/rtw_ieee80211.c +9 -14
@@ -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_iememcpy (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