summaryrefslogtreecommitdiffstats
path: root/drivers/staging/wfx
diff options
context:
space:
mode:
authorJérôme Pouiller <jerome.pouiller@silabs.com>2020-05-12 17:04:13 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-05-13 13:49:45 +0200
commitd99ce4a1e5a2d49185bffa2ea7f37df1ad51c649 (patch)
tree254f153013e367daf665740a5b3a6239731924b6 /drivers/staging/wfx
parent8008b480e25b0c88e1d6768bd8a440babb787307 (diff)
downloadlinux-d99ce4a1e5a2d49185bffa2ea7f37df1ad51c649.tar.bz2
staging: wfx: fix endianness of the field 'channel_number'
The field 'channel_number' from the structs hif_ind_rx and hif_req_start is a __le32. Sparse complains this field is not always correctly accessed: drivers/staging/wfx/data_rx.c:95:55: warning: incorrect type in argument 1 (different base types) drivers/staging/wfx/data_rx.c:95:55: expected int chan drivers/staging/wfx/data_rx.c:95:55: got restricted __le16 const [usertype] channel_number However, the value of channel_number cannot be greater than 14 (this device only support 2.4Ghz band). So, we only have to access to the least significant byte. It is finally easier to declare it as an array of bytes and only access to the first one. Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com> Link: https://lore.kernel.org/r/20200512150414.267198-17-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/wfx')
-rw-r--r--drivers/staging/wfx/hif_api_cmd.h15
-rw-r--r--drivers/staging/wfx/hif_tx.c4
2 files changed, 11 insertions, 8 deletions
diff --git a/drivers/staging/wfx/hif_api_cmd.h b/drivers/staging/wfx/hif_api_cmd.h
index 8c48477e8797..21cde19cff75 100644
--- a/drivers/staging/wfx/hif_api_cmd.h
+++ b/drivers/staging/wfx/hif_api_cmd.h
@@ -321,7 +321,8 @@ struct hif_rx_flags {
struct hif_ind_rx {
__le32 status;
- __le16 channel_number;
+ u8 channel_number;
+ u8 reserved;
u8 rxed_rate;
u8 rcpi_rssi;
struct hif_rx_flags rx_flags;
@@ -356,7 +357,8 @@ struct hif_req_join {
u8 infrastructure_bss_mode:1;
u8 reserved1:7;
u8 band;
- __le16 channel_number;
+ u8 channel_number;
+ u8 reserved;
u8 bssid[ETH_ALEN];
__le16 atim_window;
u8 short_preamble:1;
@@ -421,13 +423,14 @@ struct hif_ind_set_pm_mode_cmpl {
struct hif_req_start {
u8 mode;
u8 band;
- __le16 channel_number;
- __le32 reserved1;
+ u8 channel_number;
+ u8 reserved1;
+ __le32 reserved2;
__le32 beacon_interval;
u8 dtim_period;
u8 short_preamble:1;
- u8 reserved2:7;
- u8 reserved3;
+ u8 reserved3:7;
+ u8 reserved4;
u8 ssid_length;
u8 ssid[HIF_API_SSID_SIZE];
__le32 basic_rate_set;
diff --git a/drivers/staging/wfx/hif_tx.c b/drivers/staging/wfx/hif_tx.c
index bb776ee6689c..7f459719e7b4 100644
--- a/drivers/staging/wfx/hif_tx.c
+++ b/drivers/staging/wfx/hif_tx.c
@@ -309,7 +309,7 @@ int hif_join(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf,
body->probe_for_join = 0;
else
body->probe_for_join = 1;
- body->channel_number = cpu_to_le16(channel->hw_value);
+ body->channel_number = channel->hw_value;
body->beacon_interval = cpu_to_le32(conf->beacon_int);
body->basic_rate_set =
cpu_to_le32(wfx_rate_mask_to_hw(wvif->wdev, conf->basic_rates));
@@ -435,7 +435,7 @@ int hif_start(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf,
WARN_ON(!conf->beacon_int);
body->dtim_period = conf->dtim_period;
body->short_preamble = conf->use_short_preamble;
- body->channel_number = cpu_to_le16(channel->hw_value);
+ body->channel_number = channel->hw_value;
body->beacon_interval = cpu_to_le32(conf->beacon_int);
body->basic_rate_set =
cpu_to_le32(wfx_rate_mask_to_hw(wvif->wdev, conf->basic_rates));