* [PATCH][next] rtw88: phy: mark expected switch fall-throughs
@ 2019-05-01 15:16 Gustavo A. R. Silva
2019-05-02 14:59 ` Kalle Valo
0 siblings, 1 reply; 2+ messages in thread
From: Gustavo A. R. Silva @ 2019-05-01 15:16 UTC (permalink / raw)
To: Yan-Hsuan Chuang, Kalle Valo, David S. Miller
Cc: linux-wireless, netdev, linux-kernel, Gustavo A. R. Silva, Kees Cook
In preparation to enabling -Wimplicit-fallthrough, mark switch
cases where we are expecting to fall through.
This patch fixes the following warnings:
drivers/net/wireless/realtek/rtw88/phy.c: In function ‘rtw_get_channel_group’:
./include/linux/compiler.h:77:22: warning: this statement may fall through [-Wimplicit-fallthrough=]
# define unlikely(x) __builtin_expect(!!(x), 0)
^~~~~~~~~~~~~~~~~~~~~~~~~~
./include/asm-generic/bug.h:125:2: note: in expansion of macro ‘unlikely’
unlikely(__ret_warn_on); \
^~~~~~~~
drivers/net/wireless/realtek/rtw88/phy.c:907:3: note: in expansion of macro ‘WARN_ON’
WARN_ON(1);
^~~~~~~
drivers/net/wireless/realtek/rtw88/phy.c:908:2: note: here
case 1:
^~~~
In file included from ./include/linux/bcd.h:5,
from drivers/net/wireless/realtek/rtw88/phy.c:5:
drivers/net/wireless/realtek/rtw88/phy.c: In function ‘phy_get_2g_tx_power_index’:
./include/linux/compiler.h:77:22: warning: this statement may fall through [-Wimplicit-fallthrough=]
# define unlikely(x) __builtin_expect(!!(x), 0)
^~~~~~~~~~~~~~~~~~~~~~~~~~
./include/asm-generic/bug.h:125:2: note: in expansion of macro ‘unlikely’
unlikely(__ret_warn_on); \
^~~~~~~~
drivers/net/wireless/realtek/rtw88/phy.c:1021:3: note: in expansion of macro ‘WARN_ON’
WARN_ON(1);
^~~~~~~
drivers/net/wireless/realtek/rtw88/phy.c:1022:2: note: here
case RTW_CHANNEL_WIDTH_20:
^~~~
Warning level 3 was used: -Wimplicit-fallthrough=3
This patch is part of the ongoing efforts to enable
-Wimplicit-fallthrough.
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
drivers/net/wireless/realtek/rtw88/phy.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/wireless/realtek/rtw88/phy.c b/drivers/net/wireless/realtek/rtw88/phy.c
index 35a35dbca85f..4381b360b5b5 100644
--- a/drivers/net/wireless/realtek/rtw88/phy.c
+++ b/drivers/net/wireless/realtek/rtw88/phy.c
@@ -905,6 +905,7 @@ static u8 rtw_get_channel_group(u8 channel)
switch (channel) {
default:
WARN_ON(1);
+ /* fall through */
case 1:
case 2:
case 36:
@@ -1019,6 +1020,7 @@ static u8 phy_get_2g_tx_power_index(struct rtw_dev *rtwdev,
switch (bandwidth) {
default:
WARN_ON(1);
+ /* fall through */
case RTW_CHANNEL_WIDTH_20:
tx_power += pwr_idx_2g->ht_1s_diff.bw20 * factor;
if (above_2ss)
@@ -1062,6 +1064,7 @@ static u8 phy_get_5g_tx_power_index(struct rtw_dev *rtwdev,
switch (bandwidth) {
default:
WARN_ON(1);
+ /* fall through */
case RTW_CHANNEL_WIDTH_20:
tx_power += pwr_idx_5g->ht_1s_diff.bw20 * factor;
if (above_2ss)
--
2.21.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH][next] rtw88: phy: mark expected switch fall-throughs
2019-05-01 15:16 [PATCH][next] rtw88: phy: mark expected switch fall-throughs Gustavo A. R. Silva
@ 2019-05-02 14:59 ` Kalle Valo
0 siblings, 0 replies; 2+ messages in thread
From: Kalle Valo @ 2019-05-02 14:59 UTC (permalink / raw)
To: Gustavo A. R. Silva
Cc: Yan-Hsuan Chuang, David S. Miller, linux-wireless, netdev,
linux-kernel, Gustavo A. R. Silva, Kees Cook
"Gustavo A. R. Silva" <gustavo@embeddedor.com> wrote:
> In preparation to enabling -Wimplicit-fallthrough, mark switch
> cases where we are expecting to fall through.
>
> This patch fixes the following warnings:
>
> drivers/net/wireless/realtek/rtw88/phy.c: In function ‘rtw_get_channel_group’:
> ./include/linux/compiler.h:77:22: warning: this statement may fall through [-Wimplicit-fallthrough=]
> # define unlikely(x) __builtin_expect(!!(x), 0)
> ^~~~~~~~~~~~~~~~~~~~~~~~~~
> ./include/asm-generic/bug.h:125:2: note: in expansion of macro ‘unlikely’
> unlikely(__ret_warn_on); \
> ^~~~~~~~
> drivers/net/wireless/realtek/rtw88/phy.c:907:3: note: in expansion of macro ‘WARN_ON’
> WARN_ON(1);
> ^~~~~~~
> drivers/net/wireless/realtek/rtw88/phy.c:908:2: note: here
> case 1:
> ^~~~
> In file included from ./include/linux/bcd.h:5,
> from drivers/net/wireless/realtek/rtw88/phy.c:5:
> drivers/net/wireless/realtek/rtw88/phy.c: In function ‘phy_get_2g_tx_power_index’:
> ./include/linux/compiler.h:77:22: warning: this statement may fall through [-Wimplicit-fallthrough=]
> # define unlikely(x) __builtin_expect(!!(x), 0)
> ^~~~~~~~~~~~~~~~~~~~~~~~~~
> ./include/asm-generic/bug.h:125:2: note: in expansion of macro ‘unlikely’
> unlikely(__ret_warn_on); \
> ^~~~~~~~
> drivers/net/wireless/realtek/rtw88/phy.c:1021:3: note: in expansion of macro ‘WARN_ON’
> WARN_ON(1);
> ^~~~~~~
> drivers/net/wireless/realtek/rtw88/phy.c:1022:2: note: here
> case RTW_CHANNEL_WIDTH_20:
> ^~~~
>
> Warning level 3 was used: -Wimplicit-fallthrough=3
>
> This patch is part of the ongoing efforts to enable
> -Wimplicit-fallthrough.
>
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Patch applied to wireless-drivers-next.git, thanks.
aa8eaaaa123a rtw88: phy: mark expected switch fall-throughs
--
https://patchwork.kernel.org/patch/10925201/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-05-02 14:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-01 15:16 [PATCH][next] rtw88: phy: mark expected switch fall-throughs Gustavo A. R. Silva
2019-05-02 14:59 ` Kalle Valo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).