All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: wilc1000: Fix incorrent type in assignment
@ 2019-02-26  3:28 Bo YU
  2019-02-26  6:39 ` Ajay.Kathat
  0 siblings, 1 reply; 3+ messages in thread
From: Bo YU @ 2019-02-26  3:28 UTC (permalink / raw)
  To: adham.abozaeid, ajay.kathat, gregkh
  Cc: Bo YU, linux-wireless, devel, linux-kernel, yuzibode

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_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 <tsu.yubo@gmail.com>
---
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(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 50dc2dd942f5..cdcb52aec779 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -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;
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] staging: wilc1000: Fix incorrent type in assignment
  2019-02-26  3:28 [PATCH] staging: wilc1000: Fix incorrent type in assignment Bo YU
@ 2019-02-26  6:39 ` Ajay.Kathat
  2019-02-26  7:27   ` YU Bo
  0 siblings, 1 reply; 3+ messages in thread
From: Ajay.Kathat @ 2019-02-26  6:39 UTC (permalink / raw)
  To: tsu.yubo, Adham.Abozaeid, gregkh
  Cc: devel, linux-wireless, linux-kernel, yuzibode



On 2/26/2019 8:58 AM, Bo YU wrote:
> 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_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 <tsu.yubo@gmail.com>
> ---
> 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);

> ---
>  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..cdcb52aec779 100644
> --- a/drivers/staging/wilc1000/host_interface.c
> +++ b/drivers/staging/wilc1000/host_interface.c
> @@ -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;
> 

Regards,
Ajay

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] staging: wilc1000: Fix incorrent type in assignment
  2019-02-26  6:39 ` Ajay.Kathat
@ 2019-02-26  7:27   ` YU Bo
  0 siblings, 0 replies; 3+ messages in thread
From: YU Bo @ 2019-02-26  7:27 UTC (permalink / raw)
  To: Ajay.Kathat
  Cc: Adham.Abozaeid, gregkh, devel, linux-wireless, linux-kernel, yuzibode

On Tue, Feb 26, 2019 at 06:39:28AM +0000, Ajay.Kathat@microchip.com wrote:
>
>
>On 2/26/2019 8:58 AM, Bo YU wrote:
>> 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_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 <tsu.yubo@gmail.com>
>> ---
>> 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);
Ok, done, thank you,
Bo
>
>> ---
>>  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..cdcb52aec779 100644
>> --- a/drivers/staging/wilc1000/host_interface.c
>> +++ b/drivers/staging/wilc1000/host_interface.c
>> @@ -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;
>>
>
>Regards,
>Ajay

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-02-26  7:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-26  3:28 [PATCH] staging: wilc1000: Fix incorrent type in assignment Bo YU
2019-02-26  6:39 ` Ajay.Kathat
2019-02-26  7:27   ` YU Bo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.