2019-02-26 07:26:06

by Bo YU

[permalink] [raw]
Subject: [PATCH V2] staging: wilc1000: fix incorrent type assignment

Fix 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_period
drivers/staging/wilc1000/host_interface.c:450:30: got unsigned short [usertype] beacon_interval
drivers/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_info
drivers/staging/wilc1000/host_interface.c:451:25: got unsigned short [usertype] capability

Signed-off-by: Bo YU <[email protected]>
---
V2: use cpu_to_le16 assign valid type according to Ajay's suggestions
---
drivers/staging/wilc1000/host_interface.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 50dc2dd942f5..20349af2ed30 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -447,8 +447,8 @@ void *wilc_parse_join_bss_param(struct cfg80211_bss *bss,
if (!param)
return NULL;

- param->beacon_period = bss->beacon_interval;
- param->cap_info = bss->capability;
+ param->beacon_period = cpu_to_le16(bss->beacon_interval);
+ param->cap_info = cpu_to_le16(bss->capability);
param->bss_type = WILC_FW_BSS_TYPE_INFRA;
param->ch = ieee80211_frequency_to_channel(bss->channel->center_freq);
ether_addr_copy(param->bssid, bss->bssid);
--
2.11.0



2019-02-26 08:24:46

by Ajay Singh

[permalink] [raw]
Subject: Re: [PATCH V2] staging: wilc1000: fix incorrent type assignment

Thanks.

On 2/26/2019 12:55 PM, Bo YU wrote:
> Fix 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_period
> drivers/staging/wilc1000/host_interface.c:450:30: got unsigned short [usertype] beacon_interval
> drivers/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_info
> drivers/staging/wilc1000/host_interface.c:451:25: got unsigned short [usertype] capability
>
> Signed-off-by: Bo YU <[email protected]>

Reviewed-by: Ajay Singh <[email protected]>

> ---
> V2: use cpu_to_le16 assign valid type according to Ajay's suggestions
> ---
> drivers/staging/wilc1000/host_interface.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
> index 50dc2dd942f5..20349af2ed30 100644
> --- a/drivers/staging/wilc1000/host_interface.c
> +++ b/drivers/staging/wilc1000/host_interface.c
> @@ -447,8 +447,8 @@ void *wilc_parse_join_bss_param(struct cfg80211_bss *bss,
> if (!param)
> return NULL;
>
> - param->beacon_period = bss->beacon_interval;
> - param->cap_info = bss->capability;
> + param->beacon_period = cpu_to_le16(bss->beacon_interval);
> + param->cap_info = cpu_to_le16(bss->capability);
> param->bss_type = WILC_FW_BSS_TYPE_INFRA;
> param->ch = ieee80211_frequency_to_channel(bss->channel->center_freq);
> ether_addr_copy(param->bssid, bss->bssid);
>