Skip to content

Commit 344c971

Browse files
nathanchancejmberg-intel
authored andcommitted
cfg80211: Change an 'else if' into an 'else' in cfg80211_calculate_bitrate_he
When building with -Wsometimes-uninitialized, Clang warns: net/wireless/util.c:1223:11: warning: variable 'result' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] Clang can't evaluate at this point that WARN(1, ...) always returns true because __ret_warn_on is defined as !!(condition), which isn't immediately evaluated as 1. Change this branch to else so that it's clear to Clang that we intend to bail out here. Link: ClangBuiltLinux/linux#382 Suggested-by: Nick Desaulniers <ndesaulniers@google.com> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent eb9b64e commit 344c971

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎net/wireless/util.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,9 +1220,11 @@ static u32 cfg80211_calculate_bitrate_he(struct rate_info *rate)
12201220
else if (rate->bw == RATE_INFO_BW_HE_RU &&
12211221
rate->he_ru_alloc == NL80211_RATE_INFO_HE_RU_ALLOC_26)
12221222
result = rates_26[rate->he_gi];
1223-
else if (WARN(1, "invalid HE MCS: bw:%d, ru:%d\n",
1224-
rate->bw, rate->he_ru_alloc))
1223+
else {
1224+
WARN(1, "invalid HE MCS: bw:%d, ru:%d\n",
1225+
rate->bw, rate->he_ru_alloc);
12251226
return 0;
1227+
}
12261228

12271229
/* now scale to the appropriate MCS */
12281230
tmp = result;

0 commit comments

Comments
 (0)