mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ricardo Silva <rjpdasilva@gmail.com>
To: AbdAllah-MEZITI <abdallah.meziti.pro@gmail.com>,
	gregkh@linuxfoundation.org
Cc: devel@driverdev.osuosl.org,
	Thibaut SAUTEREAU <thibaut.sautereau@telecom-sudparis.eu>,
	Juliana Rodrigues <juliana.orod@gmail.com>,
	sayli karnik <karniksayli1995@gmail.com>,
	linux-kernel@vger.kernel.org,
	Sergio Paracuellos <sergio.paracuellos@gmail.com>,
	Jannik Becher <becher.jannik@gmail.com>
Subject: Re: [PATCH] staging: wlan-ng: Fix sparse warning: cast to restricted __le16.
Date: Fri, 18 Aug 2017 19:49:56 +0100	[thread overview]
Message-ID: <ff9b73a9-c504-895f-0a62-d76a3057772e@gmail.com> (raw)
In-Reply-To: <1502318151-32602-1-git-send-email-abdallah.meziti.pro@gmail.com>

Hi,

On 08/09/2017 11:35 PM, AbdAllah-MEZITI wrote:
> The same structure is used in both side, so we dont need to cast.

I believe there were no casts there, but calls to le16_to_cpu(),
meaning there was previously a bug or the data being accessed was
really stored in little-endian format, so we shouldn't just remove
them for silencing sparse.

> This will fix the following sparse warnings:
> drivers/staging/wlan-ng/prism2sta.c:1139:13: warning: cast to restricted __le16
> drivers/staging/wlan-ng/prism2sta.c:1150:24: warning: cast to restricted __le16
> drivers/staging/wlan-ng/prism2sta.c:1157:37: warning: cast to restricted __le16
> drivers/staging/wlan-ng/prism2sta.c:1158:37: warning: cast to restricted __le16
> drivers/staging/wlan-ng/prism2sta.c:1159:40: warning: cast to restricted __le16
> drivers/staging/wlan-ng/prism2sta.c:1450:31: warning: cast to restricted __le16
> 
> Signed-off-by: AbdAllah MEZITI <abdallah.meziti.pro@gmail.com>
> ---
>  drivers/staging/wlan-ng/prism2sta.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/staging/wlan-ng/prism2sta.c b/drivers/staging/wlan-ng/prism2sta.c
> index 8c34712..c9df450 100644
> --- a/drivers/staging/wlan-ng/prism2sta.c
> +++ b/drivers/staging/wlan-ng/prism2sta.c
> @@ -1136,7 +1136,7 @@ static void prism2sta_inf_chinforesults(struct wlandevice *wlandev,
>  	unsigned int i, n;
>  
>  	hw->channel_info.results.scanchannels =
> -	    le16_to_cpu(inf->info.chinforesult.scanchannels);
> +	    inf->info.chinforesult.scanchannels;

If this is not fixing some issue, then I believe it can be introducing
one on big-endian CPUs, right?

>  
>  	for (i = 0, n = 0; i < HFA384x_CHINFORESULT_MAX; i++) {
>  		struct hfa384x_ch_info_result_sub *result;
> @@ -1147,16 +1147,16 @@ static void prism2sta_inf_chinforesults(struct wlandevice *wlandev,
>  			continue;
>  
>  		result = &inf->info.chinforesult.result[n];
> -		chan = le16_to_cpu(result->chid) - 1;
> +		chan = result->chid - 1;

Ditto.

>  
>  		if (chan < 0 || chan >= HFA384x_CHINFORESULT_MAX)
>  			continue;
>  
>  		chinforesult = &hw->channel_info.results.result[chan];
>  		chinforesult->chid = chan;
> -		chinforesult->anl = le16_to_cpu(result->anl);
> -		chinforesult->pnl = le16_to_cpu(result->pnl);
> -		chinforesult->active = le16_to_cpu(result->active);
> +		chinforesult->anl = result->anl;
> +		chinforesult->pnl = result->pnl;
> +		chinforesult->active = result->active;

Ditto.

>  
>  		pr_debug("chinfo: channel %d, %s level (avg/peak)=%d/%d dB, pcf %d\n",
>  			 chan + 1,
> @@ -1447,7 +1447,7 @@ static void prism2sta_inf_linkstatus(struct wlandevice *wlandev,
>  {
>  	struct hfa384x *hw = wlandev->priv;
>  
> -	hw->link_status_new = le16_to_cpu(inf->info.linkstatus.linkstatus);
> +	hw->link_status_new = inf->info.linkstatus.linkstatus;

Ditto.
If I'm wrong about this being incorrect, then I have a patch submitted for fixing
the sparse warning here that should be discarded. My patch is:

  staging: wlan-ng: hfa384x.h: Use endian type in 'hfa384x_link_status'

and changes the linkstatus field to le16.

Regards,

Ricardo Silva

>  
>  	schedule_work(&hw->link_bh);
>  }
> 

      reply	other threads:[~2017-08-18 18:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-09 22:35 AbdAllah-MEZITI
2017-08-18 18:49 ` Ricardo Silva [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ff9b73a9-c504-895f-0a62-d76a3057772e@gmail.com \
    --to=rjpdasilva@gmail.com \
    --cc=abdallah.meziti.pro@gmail.com \
    --cc=becher.jannik@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=juliana.orod@gmail.com \
    --cc=karniksayli1995@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sergio.paracuellos@gmail.com \
    --cc=thibaut.sautereau@telecom-sudparis.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®