linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ben Greear <greearb@candelatech.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Kalle Valo <kvalo@adurom.com>,
	Rajkumar Manoharan <rmanohar@qca.qualcomm.com>,
	linville@tuxdriver.com, linux-wireless@vger.kernel.org
Subject: Re: [PATCH 3/3] ath9k: fix 'side effect in macro' smatch warning
Date: Fri, 22 Jun 2012 07:24:54 -0700	[thread overview]
Message-ID: <4FE48036.1020708@candelatech.com> (raw)
In-Reply-To: <20120622115559.GD5390@mwanda>

On 06/22/2012 04:55 AM, Dan Carpenter wrote:
> On Fri, Jun 22, 2012 at 10:17:23AM +0300, Kalle Valo wrote:
>> Rajkumar Manoharan<rmanohar@qca.qualcomm.com>  writes:
>>
>>> ath9k_get_et_stats() warn: side effect in macro
>>> 'AWDATA' doing 'i++'
>>>
>>> Cc: Ben Greear<greearb@candelatech.com>
>>> Signed-off-by: Rajkumar Manoharan<rmanohar@qca.qualcomm.com>
>>
>> [...]
>>
>>>   	do {								\
>>> -		data[i++] = sc->debug.stats.txstats[PR_QNUM(WME_AC_BE)].elem; \
>>> -		data[i++] = sc->debug.stats.txstats[PR_QNUM(WME_AC_BK)].elem; \
>>> -		data[i++] = sc->debug.stats.txstats[PR_QNUM(WME_AC_VI)].elem; \
>>> -		data[i++] = sc->debug.stats.txstats[PR_QNUM(WME_AC_VO)].elem; \
>>> +		data[i+0] = sc->debug.stats.txstats[PR_QNUM(WME_AC_BE)].elem; \
>>> +		data[i+1] = sc->debug.stats.txstats[PR_QNUM(WME_AC_BK)].elem; \
>>> +		data[i+2] = sc->debug.stats.txstats[PR_QNUM(WME_AC_VI)].elem; \
>>> +		data[i+3] = sc->debug.stats.txstats[PR_QNUM(WME_AC_VO)].elem; \
>>> +		i += 4; \
>>>   	} while (0)
>>
>> I agree with Ben, this is a useless change as the end result is still
>> the same (the side effect is that i is increased with four). You are
>> just hiding that from smatch and once smatch is fixed it will warn again
>> about the same thing.
>>
>> I recommend fixing this properly so that the macro doesn't have any side
>> effects.
>
> Uh.  Sorry, also I thought I had pushed a fix to add this to the
> ignored macro list, but I forgot.  I've pushed it now.

The whole point of the macro is to have an affect.  This is not a general
purpose macro..it's very specific to this local logic.

I don't think folks should be so dogmatic about these sorts of things.

Thanks,
Ben


-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com

  reply	other threads:[~2012-06-22 14:25 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-21 18:31 [PATCH 0/3] ath9k: Fix smatch warnings Rajkumar Manoharan
2012-06-21 18:31 ` [PATCH 1/3] ath9k_hw: fix buffer overflow smatch warning Rajkumar Manoharan
2012-06-21 18:31 ` [PATCH 2/3] ath9k_hw: fix smatch warnings in spur_mitigate Rajkumar Manoharan
2012-06-22  7:23   ` Kalle Valo
2012-06-22  9:22     ` Rajkumar Manoharan
2012-06-22 11:44       ` Kalle Valo
2012-06-22 11:57         ` Dan Carpenter
2012-06-22 12:42           ` Rajkumar Manoharan
2012-06-21 18:31 ` [PATCH 3/3] ath9k: fix 'side effect in macro' smatch warning Rajkumar Manoharan
2012-06-21 18:42   ` Ben Greear
2012-06-21 19:07     ` Rajkumar Manoharan
2012-06-21 19:15       ` Ben Greear
2012-06-21 19:20         ` Rajkumar Manoharan
2012-06-22  7:17   ` Kalle Valo
2012-06-22 11:55     ` Dan Carpenter
2012-06-22 14:24       ` Ben Greear [this message]
2012-06-22 14:32         ` Dan Carpenter

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=4FE48036.1020708@candelatech.com \
    --to=greearb@candelatech.com \
    --cc=dan.carpenter@oracle.com \
    --cc=kvalo@adurom.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=rmanohar@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).