[PATCH] staging: rtl8192e: fix wrong assignment

Dan Carpenter dan.carpenter at oracle.com
Fri May 1 07:46:53 UTC 2015


The subject says "fix" but this does not fix a run time bug, it just
silences a warning.  It's still the correct thing according to Larry
so that's good.

On Thu, Apr 30, 2015 at 12:06:28PM +0000, Gujulan Elango, Hari Prasath (H.) wrote:
> This patch addresses a spatch warning on assigning a negative
> value to a unsigned integer.

It's not an unsigned integer, it's an u8.

> Similar patch has been submitted by
> Larry Finger earlier to silence the same spatch warning in another
> file.

A similar warning but a totally different patch.

> diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
> index 352d381..41d2f3f 100644
> --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
> +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
> @@ -2310,7 +2310,7 @@ static void rtl8192_rx_normal(struct net_device *dev)
>  
>  	struct rtllib_rx_stats stats = {
>  		.signal = 0,
> -		.noise = -98,
> +		.noise = 158, /*-98 -dBm*/

Let's just do this:

		.noise = (u8) -98,

That way it silences the warning and we don't need the comment.

regards,
dan carpenter



More information about the devel mailing list