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>
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;
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;
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;
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));
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));