Re: [PATCHv2] staging: rtl8192e: fix wrong assignment

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On 04.05.2015 11:29, Gujulan Elango, Hari Prasath (H.) wrote:
> This patch addresses a spatch warning on assigning a negative
> value to a unsigned integer.Similar patch has been submitted by
> Larry Finger earlier to silence the same spatch warning in another
> file.
> 
> Signed-off-by: Hari Prasath Gujulan Elango <hgujulan@xxxxxxxxxxx>
> ---
> 	v2: Address Dan Carpenter review comments for version 1 of this
> 	    patch.
> ---
>  drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
> index 352d381..a7a1ade 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 = (u8) -98,
>  		.rate = 0,
>  		.freq = RTLLIB_24GHZ_BAND,
>  	};
> 

Small suggestion from my side - a bit late, but I was unable to check code earlier - so please don't
do v3 unless others say so.

As far as I know (radio) noise is rarely above 0 dBm - if it is, you're doing something wrong.
This means we can just change rtllib_rx_stats::noise to s8.

Then, we need to add cast in other place - when we access struct iw_quality (wireless.h).

Maybe we should even talk with wireless guys and change noise there as well.

Rationale:
127 dbM = ~5 GW (Giga Watt) - I doubt we can have transmitter with such power in nearest future;)
-128 dbM = <1fW (femto Watt, 1e-15) - thermal noise for wifi is > -100dBm


Regards,
Mateusz
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux