* [PATCH] iwlwifi: work around -Wenum-compare-conditional warning
@ 2024-10-18 15:18 Arnd Bergmann
2024-10-18 16:06 ` Kalle Valo
0 siblings, 1 reply; 4+ messages in thread
From: Arnd Bergmann @ 2024-10-18 15:18 UTC (permalink / raw)
To: Miri Korenblit, Kalle Valo
Cc: Arnd Bergmann, Johannes Berg, Emmanuel Grumbach, Gregory Greenman,
Daniel Gabay, Benjamin Berg, Ilan Peer, linux-wireless,
linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
This is one of only three -Wenum-compare-conditional warnings we get
in randconfig builds:
drivers/net/wireless/intel/iwlwifi/mvm/sta.c:4331:17: error: conditional expression between different enumeration types ('enum iwl_fw_sta_type' and 'enum iwl_sta_type') [-Werror,-Wenum-compare-conditional]
4331 | u32 type = mld ? STATION_TYPE_PEER : IWL_STA_LINK;
| ^ ~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~
This is a false positive since the code works as intended, but the
warning is otherwise sensible, so slightly rewrite it in order to
not trigger the warning.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
I also tried a more complex approach of splitting the function into
two separate ones, since the 'mld' behavior is already quite different
from the other path. The version I post here ended up looking simpler
to me, but I can also send the other one if the maintainers prefer.
---
drivers/net/wireless/intel/iwlwifi/mvm/sta.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
index b6c99cd6d9e5..9d05c344d967 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
@@ -4328,7 +4328,10 @@ int iwl_mvm_add_pasn_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
unsigned int wdg_timeout =
iwl_mvm_get_wd_timeout(mvm, vif);
bool mld = iwl_mvm_has_mld_api(mvm->fw);
- u32 type = mld ? STATION_TYPE_PEER : IWL_STA_LINK;
+ u32 type = IWL_STA_LINK;
+
+ if (mld)
+ type = STATION_TYPE_PEER;
ret = iwl_mvm_allocate_int_sta(mvm, sta, 0,
NL80211_IFTYPE_UNSPECIFIED, type);
--
2.39.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] iwlwifi: work around -Wenum-compare-conditional warning
2024-10-18 15:18 [PATCH] iwlwifi: work around -Wenum-compare-conditional warning Arnd Bergmann
@ 2024-10-18 16:06 ` Kalle Valo
2024-10-18 19:07 ` Arnd Bergmann
0 siblings, 1 reply; 4+ messages in thread
From: Kalle Valo @ 2024-10-18 16:06 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Miri Korenblit, Arnd Bergmann, Johannes Berg, Emmanuel Grumbach,
Gregory Greenman, Daniel Gabay, Benjamin Berg, Ilan Peer,
linux-wireless, linux-kernel
Arnd Bergmann <arnd@kernel.org> writes:
> From: Arnd Bergmann <arnd@arndb.de>
>
> This is one of only three -Wenum-compare-conditional warnings we get
> in randconfig builds:
>
> drivers/net/wireless/intel/iwlwifi/mvm/sta.c:4331:17: error: conditional expression between different enumeration types ('enum iwl_fw_sta_type' and 'enum iwl_sta_type') [-Werror,-Wenum-compare-conditional]
> 4331 | u32 type = mld ? STATION_TYPE_PEER : IWL_STA_LINK;
> | ^ ~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~
>
> This is a false positive since the code works as intended, but the
> warning is otherwise sensible, so slightly rewrite it in order to
> not trigger the warning.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Is this and the other rtw89 patch for current release or -next?
--
https://patchwork.kernel.org/project/linux-wireless/list/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] iwlwifi: work around -Wenum-compare-conditional warning
2024-10-18 16:06 ` Kalle Valo
@ 2024-10-18 19:07 ` Arnd Bergmann
2024-10-21 7:30 ` Kalle Valo
0 siblings, 1 reply; 4+ messages in thread
From: Arnd Bergmann @ 2024-10-18 19:07 UTC (permalink / raw)
To: Kalle Valo, Arnd Bergmann
Cc: Miri Korenblit, Johannes Berg, Emmanuel Grumbach,
Gregory Greenman, Daniel Gabay, Benjamin Berg, Ilan Peer,
linux-wireless, linux-kernel
On Fri, Oct 18, 2024, at 16:06, Kalle Valo wrote:
> Arnd Bergmann <arnd@kernel.org> writes:
>
>> From: Arnd Bergmann <arnd@arndb.de>
>>
>> This is one of only three -Wenum-compare-conditional warnings we get
>> in randconfig builds:
>>
>> drivers/net/wireless/intel/iwlwifi/mvm/sta.c:4331:17: error: conditional expression between different enumeration types ('enum iwl_fw_sta_type' and 'enum iwl_sta_type') [-Werror,-Wenum-compare-conditional]
>> 4331 | u32 type = mld ? STATION_TYPE_PEER : IWL_STA_LINK;
>> | ^ ~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~
>>
>> This is a false positive since the code works as intended, but the
>> warning is otherwise sensible, so slightly rewrite it in order to
>> not trigger the warning.
>>
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>
> Is this and the other rtw89 patch for current release or -next?
Up to you, the warning has existed for a long time at W=1
level, so the patch applies to current and stable kernels
as well, but it's not a regression or particularly important.
It would be nice to turn on the warning by default in 6.13
once the three patches I sent get applied.
Arnd
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] iwlwifi: work around -Wenum-compare-conditional warning
2024-10-18 19:07 ` Arnd Bergmann
@ 2024-10-21 7:30 ` Kalle Valo
0 siblings, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2024-10-21 7:30 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Arnd Bergmann, Miri Korenblit, Johannes Berg, Emmanuel Grumbach,
Gregory Greenman, Daniel Gabay, Benjamin Berg, Ilan Peer,
linux-wireless, linux-kernel
"Arnd Bergmann" <arnd@arndb.de> writes:
> On Fri, Oct 18, 2024, at 16:06, Kalle Valo wrote:
>> Arnd Bergmann <arnd@kernel.org> writes:
>>
>>> From: Arnd Bergmann <arnd@arndb.de>
>>>
>>> This is one of only three -Wenum-compare-conditional warnings we get
>>> in randconfig builds:
>>>
>>> drivers/net/wireless/intel/iwlwifi/mvm/sta.c:4331:17: error: conditional expression between different enumeration types ('enum iwl_fw_sta_type' and 'enum iwl_sta_type') [-Werror,-Wenum-compare-conditional]
>>> 4331 | u32 type = mld ? STATION_TYPE_PEER : IWL_STA_LINK;
>>> | ^ ~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~
>>>
>>> This is a false positive since the code works as intended, but the
>>> warning is otherwise sensible, so slightly rewrite it in order to
>>> not trigger the warning.
>>>
>>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>>
>> Is this and the other rtw89 patch for current release or -next?
>
> Up to you, the warning has existed for a long time at W=1
> level, so the patch applies to current and stable kernels
> as well, but it's not a regression or particularly important.
Ok, I guess -next is more approriate then.
> It would be nice to turn on the warning by default in 6.13
> once the three patches I sent get applied.
It's not certain if driver specific trees make it to v6.13 so should the
patches applied directly to wireless-next?
--
https://patchwork.kernel.org/project/linux-wireless/list/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-10-21 7:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-18 15:18 [PATCH] iwlwifi: work around -Wenum-compare-conditional warning Arnd Bergmann
2024-10-18 16:06 ` Kalle Valo
2024-10-18 19:07 ` Arnd Bergmann
2024-10-21 7:30 ` 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).