On Thu, Jun 21, 2012 at 12:15:26PM -0700, Ben Greear wrote: > On 06/21/2012 12:07 PM, Rajkumar Manoharan wrote: > >On Thu, Jun 21, 2012 at 11:42:53AM -0700, Ben Greear wrote: > >>On 06/21/2012 11:31 AM, Rajkumar Manoharan wrote: > >>>ath9k_get_et_stats() warn: side effect in macro > >>>'AWDATA' doing 'i++' > >>> > >>>Cc: Ben Greear<greearb@xxxxxxxxxxxxxxx> > >>>Signed-off-by: Rajkumar Manoharan<rmanohar@xxxxxxxxxxxxxxxx> > >>>--- > >>> drivers/net/wireless/ath/ath9k/main.c | 9 +++++---- > >>> 1 file changed, 5 insertions(+), 4 deletions(-) > >>> > >>>diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c > >>>index 85f9ab4..32474b0 100644 > >>>--- a/drivers/net/wireless/ath/ath9k/main.c > >>>+++ b/drivers/net/wireless/ath/ath9k/main.c > >>>@@ -2003,10 +2003,11 @@ static int ath9k_get_et_sset_count(struct ieee80211_hw *hw, > >>> #define PR_QNUM(_n) (sc->tx.txq_map[_n]->axq_qnum) > >>> #define AWDATA(elem) \ > >>> 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) > >> > >>The macro is still changing i. So, whatever smatch is, seems it > >>should still warn, or it's broken :P > >> > >No it is not. The warning message is a hint. The smatch assumes that replacing > >the macro 'i++' might cause unexpected behaviour like 5++ in each statement. > > Well, my opinion is that your patch only adds un-needed code and that > smatch is either currently giving false-positives, or that it is > missing a warning when you add your patch. > > But, not a big deal either way. > Thanks. Most of my smatch fixes could address false-positives. Anyway i prefer warning free code :) -Rajkumar -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html