summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2020-09-23 11:42:03 +0300
committerJohannes Berg <johannes.berg@intel.com>2020-09-28 15:20:58 +0300
commit735b2673941ec22ae866216db32bb553fec42aeb (patch)
tree20182c2e3d7f14c09d3c8432a84a3b0501e587e2
parente3f25908b0b2e7e1d04d35ce46c9b9d4e4519b43 (diff)
downloadlinux-735b2673941ec22ae866216db32bb553fec42aeb.tar.xz
cfg80211: regulatory: remove a bogus initialization
The the __freq_reg_info() never returns NULL and the callers don't check for NULL. This initialization to set "reg_rule = NULL;" is just there to make GCC happy but it's not required in current GCCs. The problem is that Smatch sees the initialization and concludes that this function can return NULL so it complains that the callers are not checking for it. Smatch used to be able to parse this correctly but we recently changed the code from: - for (bw = MHZ_TO_KHZ(20); bw >= min_bw; bw = bw / 2) { + for (bw = MHZ_TO_KHZ(bws[i]); bw >= min_bw; bw = MHZ_TO_KHZ(bws[i--])) { Originally Smatch used to understand that this code always iterates through the loop once, but the change from "MHZ_TO_KHZ(20)" to "MHZ_TO_KHZ(bws[i])" is too complicated for Smatch. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Link: https://lore.kernel.org/r/20200923084203.GC1454948@mwanda Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r--net/wireless/reg.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 6043a9d33d61..3dab859641e1 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -1616,8 +1616,8 @@ static const struct ieee80211_reg_rule *
__freq_reg_info(struct wiphy *wiphy, u32 center_freq, u32 min_bw)
{
const struct ieee80211_regdomain *regd = reg_get_regdomain(wiphy);
- const struct ieee80211_reg_rule *reg_rule = NULL;
const u32 bws[] = {0, 1, 2, 4, 5, 8, 10, 16, 20};
+ const struct ieee80211_reg_rule *reg_rule;
int i = ARRAY_SIZE(bws) - 1;
u32 bw;