staging: wilc1000: Fix incorrent type in assignment
PATCH 1/1 staging: wilc1000: Fix incorrent type in assignment
The patch fixes following sparse warning:
drivers/staging/wilc1000/host_interface.c:450:30: warning: incorrect type in assignment (different base types)drivers/staging/wilc1000/host_interface.c:450:30: expected restricted __le16 [usertype] beacon_perioddrivers/staging/wilc1000/host_interface.c:450:30: got unsigned short [usertype] beacon_intervaldrivers/staging/wilc1000/host_interface.c:451:25: warning: incorrect type in assignment (different base types)drivers/staging/wilc1000/host_interface.c:451:25: expected restricted __le16 [usertype] cap_infodrivers/staging/wilc1000/host_interface.c:451:25: got unsigned short [usertype] capability
---
I have no hardware to test it and just to compile it
--- drivers/staging/wilc1000/host_interface.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/wilc1000/host_interface.c +2 -2
@@ -106,10 +106,10 @@ struct wilc_join_bss_param {u8 ssid_terminator;u8 bss_type;u8 ch; -__le16 cap_info; +u16 cap_info;u8 sa[ETH_ALEN ];u8 bssid[ETH_ALEN ]; -__le16 beacon_period; +u16 beacon_period;u8 dtim_period;u8 supp_rates[WILC_MAX_RATES_SUPPORTED +1 ];u8 wmm_cap;
Signature · 1 line
2.11.0
Quoted 9 lines · Bo YU
The patch fixes following sparse warning:
drivers/staging/wilc1000/host_interface.c:450:30: warning: incorrect type in assignment (different base types)drivers/staging/wilc1000/host_interface.c:450:30: expected restricted__le16[usertype]beacon_perioddrivers/staging/wilc1000/host_interface.c:450:30: got unsigned short [usertype]beacon_intervaldrivers/staging/wilc1000/host_interface.c:451:25: warning: incorrect type in assignment (different base types)drivers/staging/wilc1000/host_interface.c:451:25: expected restricted__le16[usertype]cap_infodrivers/staging/wilc1000/host_interface.c:451:25: got unsigned short [usertype] capability
Quoted 3 lines
Signed-off-by Bo YU <[email protected]>---
I have no hardware to test it and just to compile it
Thanks for submitting the patch.
The correct way to fix above spare warning is by using cpu_to_le16() while filing the information in ->beacon_period and ->cap_info because wilc1000 module expects the data in _le_ byte order.
Please changes the below lines in host_interface.c and resubmit the patch.
param->beacon_period = bss->beacon_interval; param->cap_info = bss->capability; to param->beacon_period = cpu_to_le16(bss->beacon_interval); param->cap_info = cpu_to_le16(bss->capability);
Quoted 12 lines
--- drivers/staging/wilc1000/host_interface.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/staging/wilc1000/host_interface.c +0
-0@@ -106,10 +106,10 @@ struct wilc_join_bss_param {u8 ssid_terminator;u8 bss_type;
drivers/staging/wilc1000/host_interface.c struct wilc_join_bss_param { · line 115
Quoted 10 lines
drivers/staging/wilc1000/host_interface.c +2
-2u8 ch; -__le16 cap_info; +u16 cap_info;u8 sa[ETH_ALEN ];u8 bssid[ETH_ALEN ]; -__le16 beacon_period; +u16 beacon_period;u8 dtim_period;u8 supp_rates[WILC_MAX_RATES_SUPPORTED +1 ];u8 wmm_cap;
Regards,
Ajay
Quoted 22 lines · On Tue, Feb 26, 2019 at 06:39:28AM +0000, [email protected] wrote:
Quoted 9 lines · Bo YU
The patch fixes following sparse warning:
drivers/staging/wilc1000/host_interface.c:450:30: warning: incorrect type in assignment (different base types)drivers/staging/wilc1000/host_interface.c:450:30: expected restricted__le16[usertype]beacon_perioddrivers/staging/wilc1000/host_interface.c:450:30: got unsigned short [usertype]beacon_intervaldrivers/staging/wilc1000/host_interface.c:451:25: warning: incorrect type in assignment (different base types)drivers/staging/wilc1000/host_interface.c:451:25: expected restricted__le16[usertype]cap_infodrivers/staging/wilc1000/host_interface.c:451:25: got unsigned short [usertype] capabilityQuoted 3 lines
Signed-off-by Bo YU <[email protected]>---
I have no hardware to test it and just to compile itThanks for submitting the patch.
The correct way to fix above spare warning is by using
cpu_to_le16()while filing the information in ->beacon_period and ->cap_info because wilc1000 module expects the data in _le_ byte order.
Quoted 6 lines
Please changes the below lines in
host_interface.cand resubmit the patch.param->beacon_period = bss->beacon_interval; param->cap_info = bss->capability; to param->beacon_period = cpu_to_le16(bss->beacon_interval); param->cap_info = cpu_to_le16(bss->capability);
Ok, done, thank you,
Bo
Quoted 26 lines
Quoted 13 lines
--- drivers/staging/wilc1000/host_interface.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/staging/wilc1000/host_interface.c +0
-0@@ -106,10 +106,10 @@ struct wilc_join_bss_param {u8 ssid_terminator;u8 bss_type;drivers/staging/wilc1000/host_interface.c struct wilc_join_bss_param { · line 115
Quoted 10 lines
drivers/staging/wilc1000/host_interface.c +2
-2u8 ch; -__le16 cap_info; +u16 cap_info;u8 sa[ETH_ALEN ];u8 bssid[ETH_ALEN ]; -__le16 beacon_period; +u16 beacon_period;u8 dtim_period;u8 supp_rates[WILC_MAX_RATES_SUPPORTED +1 ];u8 wmm_cap;Regards,
Ajay