All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Muhammad Usama Anjum <musamaanjum@gmail.com>
Cc: lee.jones@linaro.org, johannes@sipsolutions.net, arnd@arndb.de,
	kuba@kernel.org, gustavoars@kernel.org, wanghai38@huawei.com,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: wimax/i2400m: don't change the endianness of one byte variable
Date: Thu, 18 Feb 2021 10:40:32 +0100	[thread overview]
Message-ID: <YC42ECUUtX1Ah90v@kroah.com> (raw)
In-Reply-To: <20210218092154.GA46388@LEGION>

On Thu, Feb 18, 2021 at 02:21:54PM +0500, Muhammad Usama Anjum wrote:
> It is wrong to change the endianness of a variable which has just one
> byte size.
> 
> Sparse warnings fixed:
> drivers/staging//wimax/i2400m/control.c:452:17: warning: cast to restricted __le32
> drivers/staging//wimax/i2400m/control.c:452:17: warning: cast to restricted __le32
> drivers/staging//wimax/i2400m/op-rfkill.c:159:14: warning: cast to restricted __le32
> drivers/staging//wimax/i2400m/op-rfkill.c:160:14: warning: cast to restricted __le32
> 
> Signed-off-by: Muhammad Usama Anjum <musamaanjum@gmail.com>
> ---
>  drivers/staging/wimax/i2400m/control.c   | 4 ++--
>  drivers/staging/wimax/i2400m/op-rfkill.c | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/wimax/i2400m/control.c b/drivers/staging/wimax/i2400m/control.c
> index 1e270b2101e8..b6b2788af162 100644
> --- a/drivers/staging/wimax/i2400m/control.c
> +++ b/drivers/staging/wimax/i2400m/control.c
> @@ -452,8 +452,8 @@ void i2400m_report_state_parse_tlv(struct i2400m *i2400m,
>  		d_printf(2, dev, "%s: RF status TLV "
>  			 "found (0x%04x), sw 0x%02x hw 0x%02x\n",
>  			 tag, I2400M_TLV_RF_STATUS,
> -			 le32_to_cpu(rfss->sw_rf_switch),
> -			 le32_to_cpu(rfss->hw_rf_switch));
> +			 rfss->sw_rf_switch,
> +			 rfss->hw_rf_switch);

What do you mean by "one byte"?  This is a le32 sized variable, right?
If not, why isn't the le32_to_cpu() call complaining?

>  		i2400m_report_tlv_rf_switches_status(i2400m, rfss);
>  	}
>  	if (0 == i2400m_tlv_match(tlv, I2400M_TLV_MEDIA_STATUS, sizeof(*ms))) {
> diff --git a/drivers/staging/wimax/i2400m/op-rfkill.c b/drivers/staging/wimax/i2400m/op-rfkill.c
> index fbddf2e18c14..a159808f0ec2 100644
> --- a/drivers/staging/wimax/i2400m/op-rfkill.c
> +++ b/drivers/staging/wimax/i2400m/op-rfkill.c
> @@ -156,8 +156,8 @@ void i2400m_report_tlv_rf_switches_status(
>  	enum i2400m_rf_switch_status hw, sw;
>  	enum wimax_st wimax_state;
>  
> -	sw = le32_to_cpu(rfss->sw_rf_switch);
> -	hw = le32_to_cpu(rfss->hw_rf_switch);
> +	sw = rfss->sw_rf_switch;
> +	hw = rfss->hw_rf_switch;

Same here.

thanks,

greg k-h

  reply	other threads:[~2021-02-18 12:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-18  9:21 [PATCH] staging: wimax/i2400m: don't change the endianness of one byte variable Muhammad Usama Anjum
2021-02-18  9:40 ` Greg KH [this message]
2021-02-18  9:54   ` Muhammad Usama Anjum
2021-02-18 18:32     ` Arnd Bergmann

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=YC42ECUUtX1Ah90v@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=arnd@arndb.de \
    --cc=devel@driverdev.osuosl.org \
    --cc=gustavoars@kernel.org \
    --cc=johannes@sipsolutions.net \
    --cc=kuba@kernel.org \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=musamaanjum@gmail.com \
    --cc=wanghai38@huawei.com \
    /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 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.