Skip to contentSkip to conversation

staging: rtl8723bs: remove useless comparison in _rtw_reg_apply_flags()

PATCH In review Andrey Strachuk 2 participants 2 messages Jul 19, 2022 – Jul 27, 2022 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: rtl8723bs: remove useless comparison in _rtw_reg_apply_flags()

Local variable 'ch' is initialized by an address of field of ieee80211_supported_band structure, so it does not make sense to compare 'ch' with NULL.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes 554c0a3abf21 ("staging: Add rtl8723bs sdio wifi driver")
---
 drivers/staging/rtl8723bs/os_dep/wifi_regd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/rtl8723bs/os_dep/wifi_regd.c +1 -2
index 5eef1d68c6f0..62fbf9e1b849 100644
@@ -74,8 +74,7 @@ static void _rtw_reg_apply_flags(struct wiphy *wiphy)
 			for (j = 0; j < sband->n_channels; j++) {
 				ch = &sband->channels[j];
 
-				if (ch)
-					ch->flags = IEEE80211_CHAN_DISABLED;
+				ch->flags = IEEE80211_CHAN_DISABLED;
 			}
 		}
 	}
Signature · 1 line
2.25.1
#1 lore raw
Quoted 3 lines · Andrey Strachuk

Local variable 'ch' is initialized by an address of field of ieee80211_supported_band structure, so it does not make sense to compare 'ch' with NULL.

Where is it initialized with an address? You need to document this here.

Quoted 5 lines

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes 554c0a3abf21 ("staging: Add rtl8723bs sdio wifi driver")

This is not a bug fix, but a code optimization, so no need for this
Fixes: tag.

thanks,

greg k-h