[PATCH] Fix checkpatch.pl warnings in rtw_ieee80211.c.

Haroen Tmimi posted 1 patch 2 days, 20 hours ago
drivers/staging/rtl8723bs/core/rtw_ieee80211.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
[PATCH] Fix checkpatch.pl warnings in rtw_ieee80211.c.
Posted by Haroen Tmimi 2 days, 20 hours ago
1. Fix "Yoda condition" style issues by moving constants to the right
   side of the comparison (e.g., changing "_SUCCESS == val" to
   "val == _SUCCESS").

2. Change the _action_public_str array to "static const char * const"
   to ensure the array entries are read-only, preventing accidental
   modification of the pointers.

Signed-off-by: Haroen Tmimi <tmimiharoen@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_ieee80211.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index 8fdeeda88..febc14de6 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
@@ -1009,7 +1009,7 @@ static int rtw_get_cipher_info(struct wlan_network *pnetwork)
 	pbuf = rtw_get_wpa_ie(&pnetwork->network.ies[12], &wpa_ielen, pnetwork->network.ie_length-12);
 
 	if (pbuf && (wpa_ielen > 0)) {
-		if (_SUCCESS == rtw_parse_wpa_ie(pbuf, wpa_ielen+2, &group_cipher, &pairwise_cipher, &is8021x)) {
+		if (rtw_parse_wpa_ie(pbuf, wpa_ielen+2, &group_cipher, &pairwise_cipher, &is8021x) == _SUCCESS) {
 			pnetwork->bcn_info.pairwise_cipher = pairwise_cipher;
 			pnetwork->bcn_info.group_cipher = group_cipher;
 			pnetwork->bcn_info.is_8021x = is8021x;
@@ -1019,7 +1019,7 @@ static int rtw_get_cipher_info(struct wlan_network *pnetwork)
 		pbuf = rtw_get_wpa2_ie(&pnetwork->network.ies[12], &wpa_ielen, pnetwork->network.ie_length-12);
 
 		if (pbuf && (wpa_ielen > 0)) {
-			if (_SUCCESS == rtw_parse_wpa2_ie(pbuf, wpa_ielen+2, &group_cipher, &pairwise_cipher, &is8021x)) {
+			if (rtw_parse_wpa2_ie(pbuf, wpa_ielen+2, &group_cipher, &pairwise_cipher, &is8021x) == _SUCCESS) {
 				pnetwork->bcn_info.pairwise_cipher = pairwise_cipher;
 				pnetwork->bcn_info.group_cipher = group_cipher;
 				pnetwork->bcn_info.is_8021x = is8021x;
@@ -1139,7 +1139,7 @@ int rtw_action_frame_parse(const u8 *frame, u32 frame_len, u8 *category, u8 *act
 	return true;
 }
 
-static const char *_action_public_str[] = {
+static const char * const _action_public_str[] = {
 	"ACT_PUB_BSSCOEXIST",
 	"ACT_PUB_DSE_ENABLE",
 	"ACT_PUB_DSE_DEENABLE",
-- 
2.53.0
Re: [PATCH] Fix checkpatch.pl warnings in rtw_ieee80211.c.
Posted by Dan Carpenter 2 days, 9 hours ago
On Wed, Feb 04, 2026 at 07:41:33PM +0100, Haroen Tmimi wrote:
> 1. Fix "Yoda condition" style issues by moving constants to the right
>    side of the comparison (e.g., changing "_SUCCESS == val" to
>    "val == _SUCCESS").
> 
> 2. Change the _action_public_str array to "static const char * const"
>    to ensure the array entries are read-only, preventing accidental
>    modification of the pointers.
> 

These are unrelated things so they should be two patches.  But
apparently someone else already did at least part of this...

regards,
dan carpenter
Re: [PATCH] Fix checkpatch.pl warnings in rtw_ieee80211.c.
Posted by Ethan Tidmore 2 days, 11 hours ago
On Wed Feb 4, 2026 at 12:41 PM CST, Haroen Tmimi wrote:
> 1. Fix "Yoda condition" style issues by moving constants to the right
>    side of the comparison (e.g., changing "_SUCCESS == val" to
>    "val == _SUCCESS").
>
> 2. Change the _action_public_str array to "static const char * const"
>    to ensure the array entries are read-only, preventing accidental
>    modification of the pointers.
>
> Signed-off-by: Haroen Tmimi <tmimiharoen@gmail.com>
> -		if (_SUCCESS == rtw_parse_wpa_ie(pbuf, wpa_ielen+2, &group_cipher, &pairwise_cipher, &is8021x)) {
> +		if (rtw_parse_wpa_ie(pbuf, wpa_ielen+2, &group_cipher, &pairwise_cipher, &is8021x) == _SUCCESS) {
>  			pnetwork->bcn_info.pairwise_cipher = pairwise_cipher;
>  			pnetwork->bcn_info.group_cipher = group_cipher;
>  			pnetwork->bcn_info.is_8021x = is8021x;
> @@ -1019,7 +1019,7 @@ static int rtw_get_cipher_info(struct wlan_network *pnetwork)
>  		pbuf = rtw_get_wpa2_ie(&pnetwork->network.ies[12], &wpa_ielen, pnetwork->network.ie_length-12);
>  
>  		if (pbuf && (wpa_ielen > 0)) {
> -			if (_SUCCESS == rtw_parse_wpa2_ie(pbuf, wpa_ielen+2, &group_cipher, &pairwise_cipher, &is8021x)) {
> +			if (rtw_parse_wpa2_ie(pbuf, wpa_ielen+2, &group_cipher, &pairwise_cipher, &is8021x) == _SUCCESS) {
>  				pnetwork->bcn_info.pairwise_cipher = pairwise_cipher;
>  				pnetwork->bcn_info.group_cipher = group_cipher;
>  				pnetwork->bcn_info.is_8021x = is8021x;
> @@ -1139,7 +1139,7 @@ int rtw_action_frame_parse(const u8 *frame, u32 frame_len, u8 *category, u8 *act
>  	return true;
>  }

This has already been fixed in staging-next. Next time use the
staging-next branch when creating patches.

>  
> -static const char *_action_public_str[] = {
> +static const char * const _action_public_str[] = {
>  	"ACT_PUB_BSSCOEXIST",
>  	"ACT_PUB_DSE_ENABLE",
>  	"ACT_PUB_DSE_DEENABLE",

This looks good, make it it's own separate patch however. Please have
one logical change per patch.

Also, your header should have "staging: rtl8723bs" at the beginning.
Thanks.

ET