2023-08-23 17:03:22

by Ping-Ke Shih

[permalink] [raw]
Subject: RE: [PATCH] wifi: rtw89: Fix clang -Wimplicit-fallthrough in rtw89_query_sar()



> -----Original Message-----
> From: Nathan Chancellor <[email protected]>
> Sent: Tuesday, August 22, 2023 11:27 PM
> To: Ping-Ke Shih <[email protected]>; [email protected]
> Cc: [email protected]; [email protected]; Damon Chen <[email protected]>;
> [email protected]; [email protected]; [email protected]; Nathan Chancellor
> <[email protected]>
> Subject: [PATCH] wifi: rtw89: Fix clang -Wimplicit-fallthrough in rtw89_query_sar()
>
> clang warns (or errors with CONFIG_WERROR=y):
>
> drivers/net/wireless/realtek/rtw89/sar.c:216:3: error: unannotated fall-through between switch labels
> [-Werror,-Wimplicit-fallthrough]
> 216 | case RTW89_TAS_STATE_DPR_FORBID:
> | ^
> drivers/net/wireless/realtek/rtw89/sar.c:216:3: note: insert 'break;' to avoid fall-through
> 216 | case RTW89_TAS_STATE_DPR_FORBID:
> | ^
> | break;
> 1 error generated.
>
> Clang is a little more pedantic than GCC, which does not warn when
> falling through to a case that is just break or return. Clang's version
> is more in line with the kernel's own stance in deprecated.rst, which
> states that all switch/case blocks must end in either break,
> fallthrough, continue, goto, or return. Add the missing break to silence
> the warning.
>
> Closes: https://github.com/ClangBuiltLinux/linux/issues/1921
> Fixes: eb2624f55ad1 ("wifi: rtw89: Introduce Time Averaged SAR (TAS) feature")
> Signed-off-by: Nathan Chancellor <[email protected]>

Acked-by: Ping-Ke Shih <[email protected]>