lkml.org 
[lkml]   [2015]   [Oct]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] staging: rtl8723au: Fix Sparse errors in rtl8723a_cmd.c
On Fri, Oct 02, 2015 at 08:36:28PM -0400, Jacob Kiefer wrote:
> From: Jacob Kiefer <jtk54@cornell.edu>
>
> This patch fixes the following sparse errors:
>
>
> CHECK drivers/staging/rtl8723au/hal/rtl8723a_cmd.c
> ...
> drivers/staging/rtl8723au/hal/rtl8723a_cmd.c:118:25: warning: incorrect type in assignment (different base types)
> drivers/staging/rtl8723au/hal/rtl8723a_cmd.c:118:25: expected unsigned int [unsigned] [usertype] <noident>
> drivers/staging/rtl8723au/hal/rtl8723a_cmd.c:118:25: got restricted __le32 [usertype] <noident>
> drivers/staging/rtl8723au/hal/rtl8723a_cmd.c:130:14: warning: incorrect type in assignment (different base types)
> drivers/staging/rtl8723au/hal/rtl8723a_cmd.c:130:14: expected unsigned int [unsigned] [usertype] mask
> drivers/staging/rtl8723au/hal/rtl8723a_cmd.c:130:14: got restricted __le32 [usertype] <noident>
> CC [M] drivers/staging/rtl8723au/hal/rtl8723a_cmd.o
>
> Signed-off-by: Jacob Kiefer <jtk54@cornell.edu>
> ---
> drivers/staging/rtl8723au/hal/rtl8723a_cmd.c | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c b/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c
> index 9733aa6..111a24d 100644
> --- a/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c
> +++ b/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c
> @@ -115,9 +115,11 @@ exit:
>
> int rtl8723a_set_rssi_cmd(struct rtw_adapter *padapter, u8 *param)
> {
> - *((u32 *)param) = cpu_to_le32(*((u32 *)param));
> + __le32 leparam;

Why __le32? Does this variable go across the user/kernel boundry
somehow? If not, just use le32.

>
> - FillH2CCmd(padapter, RSSI_SETTING_EID, 3, param);
> + leparam = cpu_to_le32(*((u32 *)param));
> +
> + FillH2CCmd(padapter, RSSI_SETTING_EID, 3, (u8 *)&leparam);

At first glance, you aren't doing ths same logic in this function as the
original did, please look at this very closely again and verify that you
are doing this correctly.

Don't just blindly quiet tools like sparse, it is warning for a reason,
but be careful about your fix.

thanks,

greg k-h


\
 
 \ /
  Last update: 2015-10-04 11:01    [W:0.892 / U:0.496 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site