[PATCH] staging: wlan-ng: Amend type mismatch warnings

Greg KH gregkh at linuxfoundation.org
Tue Jun 13 09:23:41 UTC 2017


On Mon, Jun 12, 2017 at 10:45:38PM +0530, sunil.m at techveda.org wrote:
> From: Suniel Mahesh <sunil.m at techveda.org>
> 
> The following type mismatch warnings reported by sparse
> have been amended:
> warning: cast to restricted __le16
> warning: incorrect type in assignment (different base types)
> 
> Signed-off-by: Suniel Mahesh <sunil.m at techveda.org>
> ---
>  drivers/staging/wlan-ng/prism2mgmt.c | 22 +++++++++++-----------
>  1 file changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/staging/wlan-ng/prism2mgmt.c b/drivers/staging/wlan-ng/prism2mgmt.c
> index f4d6e48..358b556 100644
> --- a/drivers/staging/wlan-ng/prism2mgmt.c
> +++ b/drivers/staging/wlan-ng/prism2mgmt.c
> @@ -185,7 +185,7 @@ int prism2mgmt_scan(struct wlandevice *wlandev, void *msgp)
>  
>  	/* set up the txrate to be 2MBPS. Should be fastest basicrate... */
>  	word = HFA384x_RATEBIT_2;
> -	scanreq.tx_rate = cpu_to_le16(word);
> +	scanreq.tx_rate = (__force u16)cpu_to_le16(word);

If you ever find yourself using __force, it is almost always the wrong
solution.  Please step back and understand what is going on here before
making a change like this.

good luck!

greg k-h


More information about the devel mailing list