Re: [PATCH] rtw89: -Wenum-compare-conditional warnings
From: Ping-Ke Shih
Date: Thu Oct 24 2024 - 22:21:39 EST
Arnd Bergmann <arnd@xxxxxxxxxx> wrote:
> From: Arnd Bergmann <arnd@xxxxxxxx>
>
> This is one of three drivers that trigger -Wenum-compare-conditional warnings
> with clang:
>
> drivers/net/wireless/realtek/rtw89/core.c:1806:14: error: conditional expression between different enumeration types ('enum nl80211_eht_gi' and 'enum nl80211_he_gi') [-Werror,-Wenum-compare-conditional]
> 1806 | return eht ? NL80211_RATE_INFO_EHT_GI_0_8 :
> | ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 1807 | NL80211_RATE_INFO_HE_GI_0_8;
> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/net/wireless/realtek/rtw89/core.c:1810:14: error: conditional expression between different enumeration types ('enum nl80211_eht_gi' and 'enum nl80211_he_gi') [-Werror,-Wenum-compare-conditional]
> 1810 | return eht ? NL80211_RATE_INFO_EHT_GI_1_6 :
> | ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 1811 | NL80211_RATE_INFO_HE_GI_1_6;
> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/net/wireless/realtek/rtw89/core.c:1813:14: error: conditional expression between different enumeration types ('enum nl80211_eht_gi' and 'enum nl80211_he_gi') [-Werror,-Wenum-compare-conditional]
> 1813 | return eht ? NL80211_RATE_INFO_EHT_GI_3_2 :
> | ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 1814 | NL80211_RATE_INFO_HE_GI_3_2;
> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/net/wireless/realtek/rtw89/core.c:1818:15: error: conditional expression between different enumeration types ('enum nl80211_eht_gi' and 'enum nl80211_he_gi') [-Werror,-Wenum-compare-conditional]
> 1818 | return eht ? NL80211_RATE_INFO_EHT_GI_3_2 :
> | ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 1819 | NL80211_RATE_INFO_HE_GI_3_2;
> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> In this case, all four warnings can be easily avoided by splitting the
> function into two separate ones, in a way that helps readability as well,
> at the expense of a few extra source lines.
>
> Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
> Reviewed-by: Nathan Chancellor <nathan@xxxxxxxxxx>
1 patch(es) applied to rtw-next branch of rtw.git, thanks.
c67d7c7f4151 wifi: rtw89: fix -Wenum-compare-conditional warnings
---
https://github.com/pkshih/rtw.git