public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: horms@vergenet.net
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@suse.de>,
	Peter Huewe <PeterHuewe@gmx.de>
Subject: Re: [patch 6/6] otus: zfRateCtrlRateDiff(): remove duplicate comparison
Date: Sat, 9 Jan 2010 11:44:38 +0300	[thread overview]
Message-ID: <20100109084438.GD7840@bicker> (raw)
In-Reply-To: <20100108075921.504899210@vergenet.net>

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


  reply	other threads:[~2010-01-09  8:45 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-08  7:57 [patch 0/6] otus: build fixes horms
2010-01-08  7:57 ` [patch 1/6] otus: dont mix declarations and code horms
2010-01-08  7:57 ` [patch 2/6] otus: remove unused variables horms
2010-01-08  7:57 ` [patch 3/6] otus: remove unused constants horms
2010-01-08  7:57 ` [patch 4/6] otus: Fix ZM_SEQ_DEBUG macro for no-debug case horms
2010-01-08  7:57 ` [patch 5/6] otus: zfTkipInit(): increment pointer horms
2010-01-09  8:44   ` [patch] otus: zfTkipInit(): increment another pointer Dan Carpenter
2010-01-12  0:50     ` [patch] tch 5/6 v2] " Simon Horman
2010-01-08  7:57 ` [patch 6/6] otus: zfRateCtrlRateDiff(): remove duplicate comparison horms
2010-01-09  8:44   ` Dan Carpenter [this message]
2010-01-11 13:06     ` Simon Horman

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=20100109084438.GD7840@bicker \
    --to=error27@gmail.com \
    --cc=PeterHuewe@gmx.de \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@suse.de \
    --cc=horms@vergenet.net \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox