From: Kalle Valo <kvalo@kernel.org>
To: toke@toke.dk
Cc: linux-wireless@vger.kernel.org
Subject: [PATCH 1/3] wifi: ath9k: ath9k_set_moredata(): fix sparse warnings
Date: Wed, 20 Mar 2024 19:06:54 +0200 [thread overview]
Message-ID: <20240320170656.3534265-2-kvalo@kernel.org> (raw)
In-Reply-To: <20240320170656.3534265-1-kvalo@kernel.org>
From: Kalle Valo <quic_kvalo@quicinc.com>
Sparse warns:
drivers/net/wireless/ath/ath9k/xmit.c:1677:20: warning: incorrect type in initializer (different base types)
drivers/net/wireless/ath/ath9k/xmit.c:1677:20: expected unsigned short [usertype] mask
drivers/net/wireless/ath/ath9k/xmit.c:1677:20: got restricted __le16 [usertype]
drivers/net/wireless/ath/ath9k/xmit.c:1681:17: warning: restricted __le16 degrades to integer
drivers/net/wireless/ath/ath9k/xmit.c:1682:42: warning: restricted __le16 degrades to integer
drivers/net/wireless/ath/ath9k/xmit.c:1682:36: warning: incorrect type in assignment (different base types)
drivers/net/wireless/ath/ath9k/xmit.c:1682:36: expected restricted __le16 [usertype] frame_control
drivers/net/wireless/ath/ath9k/xmit.c:1682:36: got int
Fix ath9k_set_moredata() to use __le16 with masks and use if statement instead
of multiply operator.
Compile tested only.
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
---
drivers/net/wireless/ath/ath9k/xmit.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
index d519b676a109..35aa47a9db90 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -1674,8 +1674,14 @@ static void
ath9k_set_moredata(struct ath_softc *sc, struct ath_buf *bf, bool val)
{
struct ieee80211_hdr *hdr;
- u16 mask = cpu_to_le16(IEEE80211_FCTL_MOREDATA);
- u16 mask_val = mask * val;
+ __le16 mask, mask_val;
+
+ mask = cpu_to_le16(IEEE80211_FCTL_MOREDATA);
+
+ if (val)
+ mask_val = mask;
+ else
+ mask_val = 0;
hdr = (struct ieee80211_hdr *) bf->bf_mpdu->data;
if ((hdr->frame_control & mask) != mask_val) {
--
2.39.2
next prev parent reply other threads:[~2024-03-20 17:07 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-20 17:06 [PATCH 0/3] wifi: ath9k: fix remaining sparse warnings Kalle Valo
2024-03-20 17:06 ` Kalle Valo [this message]
2024-03-20 17:34 ` [PATCH 1/3] wifi: ath9k: ath9k_set_moredata(): fix " Jeff Johnson
2024-03-21 18:37 ` Toke Høiland-Jørgensen
2024-03-25 10:51 ` Kalle Valo
2024-03-20 17:06 ` [PATCH 2/3] wifi: ath9k: fix ath9k_use_msi declaration Kalle Valo
2024-03-20 17:34 ` Jeff Johnson
2024-03-21 18:37 ` Toke Høiland-Jørgensen
2024-03-20 17:06 ` [PATCH 3/3] wifi: ath9k: eeprom: fix sparse endian warnings Kalle Valo
2024-03-20 17:34 ` Jeff Johnson
2024-03-21 18:37 ` Toke Høiland-Jørgensen
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=20240320170656.3534265-2-kvalo@kernel.org \
--to=kvalo@kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=toke@toke.dk \
/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 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).