]> git.itanic.dy.fi Git - linux-stable/commitdiff
wifi: rtw89: Fix clang -Wimplicit-fallthrough in rtw89_query_sar()
authorNathan Chancellor <nathan@kernel.org>
Tue, 22 Aug 2023 15:27:16 +0000 (08:27 -0700)
committerKalle Valo <kvalo@kernel.org>
Fri, 25 Aug 2023 10:00:24 +0000 (13:00 +0300)
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 <nathan@kernel.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230822-rtw89-tas-clang-implicit-fallthrough-v1-1-5cb73f0fa976@kernel.org
drivers/net/wireless/realtek/rtw89/sar.c

index 881322f85d79dd5cbfe5bbbeac1461611e068afc..aed05b026c6c32c23bde647b11305680cb0607d1 100644 (file)
@@ -211,6 +211,7 @@ s8 rtw89_query_sar(struct rtw89_dev *rtwdev, u32 center_freq)
                case RTW89_TAS_STATE_DPR_ON:
                        delta = rtw89_txpwr_tas_to_sar(sar_hdl, tas->delta);
                        cfg -= delta;
+                       break;
                case RTW89_TAS_STATE_DPR_FORBID:
                default:
                        break;