From: Arnd Bergmann <arnd@kernel.org>
To: Miri Korenblit <miriam.rachel.korenblit@intel.com>,
Kalle Valo <kvalo@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>,
Johannes Berg <johannes.berg@intel.com>,
Emmanuel Grumbach <emmanuel.grumbach@intel.com>,
Gregory Greenman <gregory.greenman@intel.com>,
Daniel Gabay <daniel.gabay@intel.com>,
Benjamin Berg <benjamin.berg@intel.com>,
Ilan Peer <ilan.peer@intel.com>,
linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] iwlwifi: work around -Wenum-compare-conditional warning
Date: Fri, 18 Oct 2024 15:18:34 +0000 [thread overview]
Message-ID: <20241018151841.3821671-1-arnd@kernel.org> (raw)
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
next reply other threads:[~2024-10-18 15:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-18 15:18 Arnd Bergmann [this message]
2024-10-18 16:06 ` [PATCH] iwlwifi: work around -Wenum-compare-conditional warning Kalle Valo
2024-10-18 19:07 ` Arnd Bergmann
2024-10-21 7:30 ` Kalle Valo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241018151841.3821671-1-arnd@kernel.org \
--to=arnd@kernel.org \
--cc=arnd@arndb.de \
--cc=benjamin.berg@intel.com \
--cc=daniel.gabay@intel.com \
--cc=emmanuel.grumbach@intel.com \
--cc=gregory.greenman@intel.com \
--cc=ilan.peer@intel.com \
--cc=johannes.berg@intel.com \
--cc=kvalo@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=miriam.rachel.korenblit@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.