wifi: ath: fix remaining sparse warnings (excluding ath9k)
Subsystems (3)
cover wifi: ath: fix remaining sparse warnings (excluding ath9k)
From: Kalle Valo <[email protected]>
With this and the ath9k patchset[1] we finally have ath drivers sparse warning free.
Please review, especially the wil6210 patch. I'm not really happy about that one.
[1] https://patchwork.kernel.org/project/linux-wireless/cover/[email protected]/
Kalle Valo (4):
wifi: ath6kl: fix sparse warnings
wifi: wcn36xx: buff_to_be(): fix sparse warnings
wifi: wcn36xx: main: fix sparse warnings
wifi: wil6210: fix sparse warnings
drivers/net/wireless/ath/ath6kl/htc_mbox.c | 3 +-- drivers/net/wireless/ath/ath6kl/htc_pipe.c | 3 +-- drivers/net/wireless/ath/wcn36xx/main.c | 4 ++-- drivers/net/wireless/ath/wcn36xx/txrx.c | 4 ++-- drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 7 +++++-- drivers/net/wireless/ath/wil6210/cfg80211.c | 4 ++-- drivers/net/wireless/ath/wil6210/fw.h | 1 - drivers/net/wireless/ath/wil6210/fw_inc.c | 4 ++-- 8 files changed, 15 insertions(+), 15 deletions(-)
base-commit: 4b2f0ce6f2fe0fd906d408a01e494b85c272c7d7
Signature · 1 line
2.39.2
PATCH 1/4 wifi: ath6kl: fix sparse warnings
From: Kalle Valo <[email protected]>
Sparse warns:
drivers/net/wireless/ath/ath6kl/htc_pipe.c:241:17: warning: incorrect type in assignment (different base types)drivers/net/wireless/ath/ath6kl/htc_pipe.c:241:17: expected restricted __le16 xdrivers/net/wireless/ath/ath6kl/htc_pipe.c:241:17: got unsigned short [usertype]drivers/net/wireless/ath/ath6kl/htc_mbox.c:368:9: warning: incorrect type in assignment (different base types)drivers/net/wireless/ath/ath6kl/htc_mbox.c:368:9: expected restricted __le16 xdrivers/net/wireless/ath/ath6kl/htc_mbox.c:368:9: got unsigned short [usertype]
Use put_unaligned_le16() so that the value is converted to little endian before storing it to the header.
Compile tested only.
--- drivers/net/wireless/ath/ath6kl/htc_mbox.c | 3 +-- drivers/net/wireless/ath/ath6kl/htc_pipe.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/net/wireless/ath/ath6kl/htc_mbox.c +1 -2
@@ -364,8 +364,7 @@ static void ath6kl_htc_tx_prep_pkt(struct htc_packet *packet, u8 flags, packet->buf -=HTC_HDR_LENGTH ; hdr = (struct htc_frame_hdr *)packet->buf; -/* Endianess? */ -put_unaligned ((u16 )packet->act_len, &hdr->payld_len); +put_unaligned_le16 (packet->act_len, &hdr->payld_len); hdr->flags = flags; hdr->eid = packet->endpoint; hdr->ctrl[0 ] = ctrl0;
drivers/net/wireless/ath/ath6kl/htc_pipe.c +1 -2
@@ -237,8 +237,7 @@ static int htc_issue_packets(struct htc_target *target, packet->info.tx.flags |=HTC_FLAGS_TX_FIXUP_NETBUF ; -/* Endianess? */ -put_unaligned ((u16 ) payload_len, &htc_hdr->payld_len); +put_unaligned_le16 (payload_len, &htc_hdr->payld_len); htc_hdr->flags = packet->info.tx.flags; htc_hdr->eid = (u8 ) packet->endpoint; htc_hdr->ctrl[0 ] =0 ;
Signature · 1 line
2.39.2
Re: [PATCH 1/4] wifi: ath6kl: fix sparse warnings
Quoted 9 lines · Kalle Valo
Sparse warns:
drivers/net/wireless/ath/ath6kl/htc_pipe.c:241:17: warning: incorrect type in assignment (different base types)drivers/net/wireless/ath/ath6kl/htc_pipe.c:241:17: expected restricted__le16xdrivers/net/wireless/ath/ath6kl/htc_pipe.c:241:17: got unsigned short [usertype]drivers/net/wireless/ath/ath6kl/htc_mbox.c:368:9: warning: incorrect type in assignment (different base types)drivers/net/wireless/ath/ath6kl/htc_mbox.c:368:9: expected restricted__le16xdrivers/net/wireless/ath/ath6kl/htc_mbox.c:368:9: got unsigned short [usertype]
Quoted 6 lines
Use
put_unaligned_le16()so that the value is converted to little endian before storing it to the header.Compile tested only.
Signed-off-by Kalle Valo <[email protected]>
4 patches applied to ath-next branch of ath.git, thanks.
ed769314f55c wifi: ath6kl: fix sparse warnings fba52950e59d wifi: wcn36xx: buff_to_be(): fix sparse warnings 1eb2ac4a9f3f wifi: wcn36xx: main: fix sparse warnings 1f4672fd1648 wifi: wil6210: fix sparse warnings
Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
PATCH 2/4 wifi: wcn36xx: buff_to_be(): fix sparse warnings
In reply to Kalle ValoFrom: Kalle Valo <[email protected]>
Sparse warns:
drivers/net/wireless/ath/wcn36xx/txrx.c: note: in included file (through drivers/net/wireless/ath/wcn36xx/txrx.h):drivers/net/wireless/ath/wcn36xx/wcn36xx.h:107:24: warning: incorrect type in assignment (different base types)drivers/net/wireless/ath/wcn36xx/wcn36xx.h:107:24: expected unsigned int [usertype]drivers/net/wireless/ath/wcn36xx/wcn36xx.h:107:24: got restricted __be32 [usertype]drivers/net/wireless/ath/wcn36xx/wcn36xx.h:107:24: warning: incorrect type in assignment (different base types)drivers/net/wireless/ath/wcn36xx/wcn36xx.h:107:24: expected unsigned int [usertype]drivers/net/wireless/ath/wcn36xx/wcn36xx.h:107:24: got restricted __be32 [usertype]
Use void pointers and two separate variables to workaround the warning. Also now the callers don't need any casting. There's actually cpu_to_be32_array() available but decided to do minimal changes instead.
Compile tested only.
--- drivers/net/wireless/ath/wcn36xx/txrx.c | 4 ++-- drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-)
drivers/net/wireless/ath/wcn36xx/txrx.c +2 -2
@@ -318,7 +318,7 @@ int wcn36xx_rx_skb(struct wcn36xx *wcn, struct sk_buff *skb)memset (&status,0 ,sizeof (status)); bd = (struct wcn36xx_rx_bd *)skb->data; -buff_to_be ((u32 *)bd,sizeof (*bd)/sizeof (u32)); +buff_to_be (bd,sizeof (*bd)/sizeof (u32));wcn36xx_dbg_dump (WCN36XX_DBG_RX_DUMP ,"BD <<< " , (char *)bd,sizeof (struct wcn36xx_rx_bd ));
@@ -692,7 +692,7 @@ int wcn36xx_start_tx(struct wcn36xx *wcn,/* MGMT and CTRL frames are handeld here*/ wcn36xx_set_tx_mgmt (&bd, wcn, &vif_priv, skb, bcast); -buff_to_be ((u32 *)&bd,sizeof (bd)/sizeof (u32)); +buff_to_be (&bd,sizeof (bd)/sizeof (u32)); bd.tx_bd_sign =0xbdbdbdbd ; ret =wcn36xx_dxe_tx_frame (wcn, vif_priv, &bd, skb, is_low);
drivers/net/wireless/ath/wcn36xx/wcn36xx.h +5 -2
@@ -100,11 +100,14 @@ enum wcn36xx_ampdu_state {#define RF_IRIS_WCN3660 0x3660#define RF_IRIS_WCN3680 0x3680 -static inline void buff_to_be (u32 *buf,size_t len) +static inline void buff_to_be (void *buf,size_t len) { +__be32 *to = buf; +u32 *from = buf;int i; +for (i =0 ; i < len; i++) - buf[i] =cpu_to_be32 (buf[i]); + to[i] =cpu_to_be32 (from[i]); }struct nv_data {
Signature · 1 line
2.39.2
PATCH 3/4 wifi: wcn36xx: main: fix sparse warnings
In reply to Kalle ValoFrom: Kalle Valo <[email protected]>
Sparse warns:
drivers/net/wireless/ath/wcn36xx/main.c:758:58: warning: incorrect type in assignment (different base types)drivers/net/wireless/ath/wcn36xx/main.c:758:58: expected unsigned short [usertype] vht_rx_mcs_mapdrivers/net/wireless/ath/wcn36xx/main.c:758:58: got restricted __le16 [usertype] rx_mcs_mapdrivers/net/wireless/ath/wcn36xx/main.c:760:58: warning: incorrect type in assignment (different base types)drivers/net/wireless/ath/wcn36xx/main.c:760:58: expected unsigned short [usertype] vht_tx_mcs_mapdrivers/net/wireless/ath/wcn36xx/main.c:760:58: got restricted __le16 [usertype] tx_mcs_map
le16_to_cpu() was just missing. Compile tested only.
--- drivers/net/wireless/ath/wcn36xx/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/wcn36xx/main.c +2 -2
@@ -756,9 +756,9 @@ static void wcn36xx_update_allowed_rates(struct ieee80211_sta *sta,if (sta->deflink.vht_cap.vht_supported) { sta_priv->supported_rates.op_rate_mode = STA_11ac; sta_priv->supported_rates.vht_rx_mcs_map = - sta->deflink.vht_cap.vht_mcs.rx_mcs_map; +le16_to_cpu (sta->deflink.vht_cap.vht_mcs.rx_mcs_map); sta_priv->supported_rates.vht_tx_mcs_map = - sta->deflink.vht_cap.vht_mcs.tx_mcs_map; +le16_to_cpu (sta->deflink.vht_cap.vht_mcs.tx_mcs_map); } }
Signature · 1 line
2.39.2
PATCH 4/4 wifi: wil6210: fix sparse warnings
In reply to Kalle ValoFrom: Kalle Valo <[email protected]>
Sparse warns:
drivers/net/wireless/ath/wil6210/fw.c: note: in included file (through drivers/net/wireless/ath/wil6210/wil6210.h):drivers/net/wireless/ath/wil6210/fw.h:96:47: warning: array of flexible structures drivers/net/wireless/ath/wil6210/cfg80211.c: note: in included file (through drivers/net/wireless/ath/wil6210/wil6210.h):drivers/net/wireless/ath/wil6210/fw.h:96:47: warning: array of flexible structures
I decided to remove the combos field altogether and just do pointer arithmetic instead. Not pretty but I didn't want to waste too much time on an orphaned driver.
Compile tested only.
--- drivers/net/wireless/ath/wil6210/cfg80211.c | 4 ++-- drivers/net/wireless/ath/wil6210/fw.h | 1 - drivers/net/wireless/ath/wil6210/fw_inc.c | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-)
drivers/net/wireless/ath/wil6210/cfg80211.c +2 -2
@@ -2735,7 +2735,7 @@ int wil_cfg80211_iface_combinations_from_fw(return 0 ; } - combo = conc->combos; + combo = (const struct wil_fw_concurrency_combo *)(conc +1 ); n_combos =le16_to_cpu (conc->n_combos);for (i =0 ; i < n_combos; i++) { total_limits += combo->n_limits;
@@ -2751,7 +2751,7 @@ int wil_cfg80211_iface_combinations_from_fw(return -ENOMEM ; iface_limit = (struct ieee80211_iface_limit *)(iface_combinations + n_combos); - combo = conc->combos; + combo = (const struct wil_fw_concurrency_combo *)(conc +1 );for (i =0 ; i < n_combos; i++) { iface_combinations[i].max_interfaces = combo->max_interfaces; iface_combinations[i].num_different_channels =
drivers/net/wireless/ath/wil6210/fw.h +0 -1
@@ -93,7 +93,6 @@ struct wil_fw_record_concurrency { /* type == wil_fw_type_comment *//* number of concurrency combinations that follow */ __le16 n_combos;/* keep last - combinations, variable size by n_combos */ -struct wil_fw_concurrency_combo combos[]; } __packed;/* brd file info encoded inside a comment record */
drivers/net/wireless/ath/wil6210/fw_inc.c +2 -2
@@ -212,8 +212,8 @@ fw_handle_concurrency(struct wil6210_priv *wil, const void *data, } n_combos =le16_to_cpu (rec->n_combos); - remain = size - offsetof(struct wil_fw_record_concurrency , combos); - combo = rec->combos; + remain = size -sizeof (struct wil_fw_record_concurrency ); + combo = (const struct wil_fw_concurrency_combo *)(rec +1 );for (i =0 ; i < n_combos; i++) {if (remain <sizeof (*combo)) goto out_short;
Signature · 1 line
2.39.2