* [PATCH] wireless: carl9170: fix clang build warning
@ 2019-03-25 12:43 Arnd Bergmann
2019-03-25 14:20 ` Christian Lamparter
2019-04-29 15:01 ` Kalle Valo
0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2019-03-25 12:43 UTC (permalink / raw)
To: Christian Lamparter, Kalle Valo, David S. Miller
Cc: clang-built-linux, Nick Desaulniers, Nathan Chancellor,
Arnd Bergmann, Dan Carpenter, Gustavo A. R. Silva, linux-wireless,
netdev, linux-kernel
clang fails to eliminate some dead code with always-taken branches
when CONFIG_PROFILE_ANNOTATED_BRANCHES is set, leading to a false-positive
warning:
drivers/net/wireless/ath/carl9170/mac.c:522:3: error: variable 'power' is used uninitialized whenever 'if' condition is
false [-Werror,-Wsometimes-uninitialized]
BUG_ON(1);
^~~~~~~~~
Change both instances of BUG_ON(1) in carl9170 to the simpler BUG()
to avoid the warning.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/net/wireless/ath/carl9170/mac.c | 2 +-
drivers/net/wireless/ath/carl9170/rx.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/ath/carl9170/mac.c b/drivers/net/wireless/ath/carl9170/mac.c
index 7d4a72dc98db..b2eeb9fd68d2 100644
--- a/drivers/net/wireless/ath/carl9170/mac.c
+++ b/drivers/net/wireless/ath/carl9170/mac.c
@@ -519,7 +519,7 @@ int carl9170_set_mac_tpc(struct ar9170 *ar, struct ieee80211_channel *channel)
power = ar->power_5G_leg[0] & 0x3f;
break;
default:
- BUG_ON(1);
+ BUG();
}
power = min_t(unsigned int, power, ar->hw->conf.power_level * 2);
diff --git a/drivers/net/wireless/ath/carl9170/rx.c b/drivers/net/wireless/ath/carl9170/rx.c
index 8e154f6364a3..23ab8a80c18c 100644
--- a/drivers/net/wireless/ath/carl9170/rx.c
+++ b/drivers/net/wireless/ath/carl9170/rx.c
@@ -795,7 +795,7 @@ static void carl9170_rx_untie_data(struct ar9170 *ar, u8 *buf, int len)
break;
default:
- BUG_ON(1);
+ BUG();
break;
}
--
2.20.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] wireless: carl9170: fix clang build warning
2019-03-25 12:43 [PATCH] wireless: carl9170: fix clang build warning Arnd Bergmann
@ 2019-03-25 14:20 ` Christian Lamparter
2019-04-29 15:01 ` Kalle Valo
1 sibling, 0 replies; 3+ messages in thread
From: Christian Lamparter @ 2019-03-25 14:20 UTC (permalink / raw)
To: Arnd Bergmann, Kalle Valo
Cc: David S. Miller, clang-built-linux, Nick Desaulniers,
Nathan Chancellor, Dan Carpenter, Gustavo A. R. Silva,
linux-wireless, netdev, linux-kernel
On Monday, March 25, 2019 1:43:44 PM CET Arnd Bergmann wrote:
> clang fails to eliminate some dead code with always-taken branches
> when CONFIG_PROFILE_ANNOTATED_BRANCHES is set, leading to a false-positive
> warning:
>
> drivers/net/wireless/ath/carl9170/mac.c:522:3: error: variable 'power' is used uninitialized whenever 'if' condition is
> false [-Werror,-Wsometimes-uninitialized]
> BUG_ON(1);
> ^~~~~~~~~
>
> Change both instances of BUG_ON(1) in carl9170 to the simpler BUG()
> to avoid the warning.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Heh, I added these "default:" cases back in the day to make gcc
shut-up about "switch is missing cases" warnings. And now I
guess it's clangs time to complain. (-;
Especially the "default case" in carl9170_rx_untie_data is hilarious.
Since all the possible cases (just 4!) have been addressed and the
"default" is deadcode. I think gcc did not consider the
AR9170_RX_STATUS_MPDU mask in the
| switch (mac_status & AR9170_RX_STATUS_MPDU) {
statement. However I'll be waiting for the day until the deadcode
elimination warnings will show up.
Anyway,
Acked-by: Christian Lamparter <chunkeey@gmail.com>
Regards,
Christian
> ---
> drivers/net/wireless/ath/carl9170/mac.c | 2 +-
> drivers/net/wireless/ath/carl9170/rx.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/carl9170/mac.c b/drivers/net/wireless/ath/carl9170/mac.c
> index 7d4a72dc98db..b2eeb9fd68d2 100644
> --- a/drivers/net/wireless/ath/carl9170/mac.c
> +++ b/drivers/net/wireless/ath/carl9170/mac.c
> @@ -519,7 +519,7 @@ int carl9170_set_mac_tpc(struct ar9170 *ar, struct ieee80211_channel *channel)
> power = ar->power_5G_leg[0] & 0x3f;
> break;
> default:
> - BUG_ON(1);
> + BUG();
> }
>
> power = min_t(unsigned int, power, ar->hw->conf.power_level * 2);
> diff --git a/drivers/net/wireless/ath/carl9170/rx.c b/drivers/net/wireless/ath/carl9170/rx.c
> index 8e154f6364a3..23ab8a80c18c 100644
> --- a/drivers/net/wireless/ath/carl9170/rx.c
> +++ b/drivers/net/wireless/ath/carl9170/rx.c
> @@ -795,7 +795,7 @@ static void carl9170_rx_untie_data(struct ar9170 *ar, u8 *buf, int len)
> break;
>
> default:
> - BUG_ON(1);
> + BUG();
> break;
> }
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] wireless: carl9170: fix clang build warning
2019-03-25 12:43 [PATCH] wireless: carl9170: fix clang build warning Arnd Bergmann
2019-03-25 14:20 ` Christian Lamparter
@ 2019-04-29 15:01 ` Kalle Valo
1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2019-04-29 15:01 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Christian Lamparter, David S. Miller, clang-built-linux,
Nick Desaulniers, Nathan Chancellor, Arnd Bergmann, Dan Carpenter,
Gustavo A. R. Silva, linux-wireless, netdev, linux-kernel
Arnd Bergmann <arnd@arndb.de> wrote:
> clang fails to eliminate some dead code with always-taken branches
> when CONFIG_PROFILE_ANNOTATED_BRANCHES is set, leading to a false-positive
> warning:
>
> drivers/net/wireless/ath/carl9170/mac.c:522:3: error: variable 'power' is used uninitialized whenever 'if' condition is
> false [-Werror,-Wsometimes-uninitialized]
> BUG_ON(1);
> ^~~~~~~~~
>
> Change both instances of BUG_ON(1) in carl9170 to the simpler BUG()
> to avoid the warning.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Acked-by: Christian Lamparter <chunkeey@gmail.com>
> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Patch applied to ath-next branch of ath.git, thanks.
62acdcfa8b7a wireless: carl9170: fix clang build warning
--
https://patchwork.kernel.org/patch/10869053/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-04-29 15:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-25 12:43 [PATCH] wireless: carl9170: fix clang build warning Arnd Bergmann
2019-03-25 14:20 ` Christian Lamparter
2019-04-29 15:01 ` 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).