All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jes Sorensen <Jes.Sorensen@redhat.com>
To: Michel von Czettritz <michel.von.czettritz@gmail.com>
Cc: gregkh@linux.com, Larry.Finger@lwfinger.net,
	devel@driverdev.osuosl.org, linux-wireless@vger.kernel.org
Subject: Re: [PATCH 2/3] staging: rtl8723au: fix "incorrect type in assignment"
Date: Wed, 01 Jul 2015 16:31:50 -0400	[thread overview]
Message-ID: <wrfj7fqj62mh.fsf@redhat.com> (raw)
In-Reply-To: <d7c0812eedadab3697323bd53aeadba48ecf6d89.1435700714.git.michel.von.czettritz@gmail.com> (Michel von Czettritz's message of "Tue, 30 Jun 2015 23:54:02 +0200")

Michel von Czettritz <michel.von.czettritz@gmail.com> writes:
> Writing the output of cpu_to_le32 to an u32 or *(u32*) is an implicit
> cast and results in an sparse warning.
>
> Since param and mask won't be changed, the implicit cast can be avoided
> by creating local variables.
>
> Signed-off-by: Michel von Czettritz <michel.von.czettritz@gmail.com>
> ---
>  drivers/staging/rtl8723au/hal/rtl8723a_cmd.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c b/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c
> index 1003365..a5e6726 100644
> --- a/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c
> +++ b/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c
> @@ -115,9 +115,10 @@ exit:
>  
>  int rtl8723a_set_rssi_cmd(struct rtw_adapter *padapter, u32 *param)
>  {
> -	*((u32 *)param) = cpu_to_le32(*(param));
> +	__le32 param_le;
> +	param_le = cpu_to_le32(*(param));
>  
> -	FillH2CCmd(padapter, RSSI_SETTING_EID, 3, (u8 *)param);
> +	FillH2CCmd(padapter, RSSI_SETTING_EID, 3, (u8 *)&param_le);
>  
>  	return _SUCCESS;
>  }
> @@ -125,10 +126,11 @@ int rtl8723a_set_rssi_cmd(struct rtw_adapter *padapter, u32 *param)
>  int rtl8723a_set_raid_cmd(struct rtw_adapter *padapter, u32 mask, u8 arg)
>  {
>  	u8 buf[5];
> +	__le32 mask_le;
>  
>  	memset(buf, 0, 5);
> -	mask = cpu_to_le32(mask);
> -	memcpy(buf, &mask, 4);
> +	mask_le = cpu_to_le32(mask);
> +	memcpy(buf, &mask_le, 4);

cpu_to_le32() + memcpy() is ugly - put_unaligned_le32() would make more
sense.

Jes

  parent reply	other threads:[~2015-07-01 20:31 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-30 21:52 [PATCH 0/3] staging: rtl8723au: fix/clean up two functions Michel von Czettritz
2015-06-30 21:53 ` [PATCH 1/3] staging: rtl8723au: adjust function param, u8* to u32* Michel von Czettritz
2015-06-30 21:54 ` [PATCH 2/3] staging: rtl8723au: fix "incorrect type in assignment" Michel von Czettritz
2015-07-01  7:06   ` Sudip Mukherjee
2015-07-01  7:56   ` Dan Carpenter
2015-07-01 20:34     ` Jes Sorensen
2015-07-01 20:31   ` Jes Sorensen [this message]
2015-07-01 23:36     ` Michel von Czettritz
2015-07-02  2:00       ` Jes Sorensen
2015-06-30 21:54 ` [PATCH 3/3] staging: rtl8723au: function no longer discards return value Michel von Czettritz
2015-07-01  7:12   ` Sudip Mukherjee
2015-07-01  7:50     ` Dan Carpenter
2015-07-01  8:08       ` Sudip Mukherjee
2015-07-01 16:50         ` Michel von Czettritz

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=wrfj7fqj62mh.fsf@redhat.com \
    --to=jes.sorensen@redhat.com \
    --cc=Larry.Finger@lwfinger.net \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linux.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=michel.von.czettritz@gmail.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.