lkml.org 
[lkml]   [2010]   [Jan]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch 6/6] otus: zfRateCtrlRateDiff(): remove duplicate comparison
On Fri, Jan 08, 2010 at 06:57:54PM +1100, horms@vergenet.net wrote:
> I think this is correct.
>
> $ gcc (Debian 4.4.2-8) 4.4.2
> Copyright (C) 2009 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions. There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
>
> $ make
> ...
> drivers/staging/otus/80211core/ratectrl.c: In function
> 'zfRateCtrlRateDiff':
> drivers/staging/otus/80211core/ratectrl.c:433: warning: suggest parentheses
> around comparison in operand of '=='
> ...
>
> Signed-off-by: Simon Horman <horms@verge.net.au>
>
> Index: linux-2.6/drivers/staging/otus/80211core/ratectrl.c
> ===================================================================
> --- linux-2.6.orig/drivers/staging/otus/80211core/ratectrl.c 2010-01-08 17:13:44.000000000 +1100
> +++ linux-2.6/drivers/staging/otus/80211core/ratectrl.c 2010-01-08 17:14:02.000000000 +1100
> @@ -430,7 +430,7 @@ u8_t zfRateCtrlRateDiff(struct zsRcCell*
> {
> return ((rcCell->currentRateIndex - i)+1)>>1;
> }
> - else if (i == rcCell->currentRateIndex == 0)
> + else if (i == rcCell->currentRateIndex)

You realize you have reversed the meaning of the test? The original
was the same as if (i != rcCell->currentRateIndex).

Your patch is possibly correct, but it's hard to know. I would
leave this for now until someone grovels through the code to find
out for sure if it should be == or !=. If we silence the warning,
no one will ever look at this code again.

regards,
dan carpenter



\
 
 \ /
  Last update: 2010-01-09 09:47    [W:0.048 / U:2.008 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site