linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felix Fietkau <nbd@openwrt.org>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: "Luis R. Rodriguez" <mcgrof@qca.qualcomm.com>,
	Rajkumar Manoharan <rmanohar@qca.qualcomm.com>,
	Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>,
	ath9k-devel@venema.h4ckr.net, kernel-janitors@vger.kernel.org,
	Jouni Malinen <jouni@qca.qualcomm.com>,
	linux-wireless@vger.kernel.org,
	"John W. Linville" <linville@tuxdriver.com>,
	Senthil Balasubramanian <senthilb@qca.qualcomm.com>
Subject: Re: [ath9k-devel] [RFC] ath9k_hw: precedence bug in ath9k_hw_set_ofdm_nil()
Date: Tue, 10 Apr 2012 11:58:26 +0200	[thread overview]
Message-ID: <4F840442.5060706@openwrt.org> (raw)
In-Reply-To: <20120410090445.GB26832@elgon.mountain>

On 2012-04-10 11:04 AM, Dan Carpenter wrote:
> This was introduced in 54da20d83f "ath9k_hw: improve ANI processing and
> rx desensitizing parameters".  It triggers a Smatch complaint because
> the "if (!x != y) { ..." formation is a common precedence error.
> 
> In this case, maybe the code was intended to be as it is.  The
> "->ofdmWeakSigDetectOff" and "->ofdm_weak_signal_on" variables are both
> boolean.
> 
> Or perhaps based we could change the != to an == and remove the negate?
> 
> But normally when I see this formation it is a precedence bug so that's
> the patch I've sent.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/net/wireless/ath/ath9k/ani.c b/drivers/net/wireless/ath/ath9k/ani.c
> index 47a9fb4..8304e27 100644
> --- a/drivers/net/wireless/ath/ath9k/ani.c
> +++ b/drivers/net/wireless/ath/ath9k/ani.c
> @@ -291,7 +291,7 @@ static void ath9k_hw_set_ofdm_nil(struct ath_hw *ah, u8 immunityLevel)
>  				     entry_ofdm->fir_step_level);
>  
>  	if ((aniState->noiseFloor >= aniState->rssiThrHigh) &&
> -	    (!aniState->ofdmWeakSigDetectOff !=
> +	    (aniState->ofdmWeakSigDetectOff !=
Looking at other Atheros code, I think this patch is wrong, it should
be: aniState->ofdmWeakSigDetectOff == entry_ofdm->ofdm_weak_signal_on

While a bit confusing, the behavior of the original code was correct,
aniState->ofdmWeakSigDetectOff is used as a boolean.

This code badly needs a cleanup, the whole mess with *on vs *off
variables is quite confusing.

- Felix

  reply	other threads:[~2012-04-10  9:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-10  9:04 [RFC] ath9k_hw: precedence bug in ath9k_hw_set_ofdm_nil() Dan Carpenter
2012-04-10  9:58 ` Felix Fietkau [this message]
2012-04-10 10:57   ` [ath9k-devel] " Dan Carpenter
2012-04-10 12:50     ` Rajkumar Manoharan

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=4F840442.5060706@openwrt.org \
    --to=nbd@openwrt.org \
    --cc=ath9k-devel@venema.h4ckr.net \
    --cc=dan.carpenter@oracle.com \
    --cc=jouni@qca.qualcomm.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=mcgrof@qca.qualcomm.com \
    --cc=rmanohar@qca.qualcomm.com \
    --cc=senthilb@qca.qualcomm.com \
    --cc=vthiagar@qca.qualcomm.com \
    /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;
as well as URLs for NNTP newsgroup(s).