]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
staging: rtl8723bs: remove recurring counter increment
authorNikolay Kulikov <nikolayof23@gmail.com>
Tue, 24 Feb 2026 16:43:19 +0000 (19:43 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 25 Feb 2026 14:59:12 +0000 (06:59 -0800)
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 <nikolayof23@gmail.com>
Link: https://patch.msgid.link/20260224164445.18316-1-nikolayof23@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8723bs/core/rtw_ieee80211.c

index 605c32fd2e88165af16f59c9ef23a1d3a2279449..e1077ca609bbb42e2598ce2657b7fe2b02f49c21 100644 (file)
@@ -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 */
        }
 }