From: walter harms <wharms@bfs.de>
To: kernel-janitors@vger.kernel.org
Subject: Re: [patch] staging: r8821ae: a couple macro expansion bugs
Date: Tue, 28 Jan 2014 14:14:21 +0000 [thread overview]
Message-ID: <52E7BB3D.4060604@bfs.de> (raw)
In-Reply-To: <20140128140052.GA15759@elgon.mountain>
Am 28.01.2014 15:00, schrieb Dan Carpenter:
> These macros need parentheses, otherwise it causes a macro expansion bug
> when they are used like this:
>
> ch->flags &= ~IEEE80211_CHAN_NO_IBSS;
>
> This was found using Smatch:
> drivers/staging/rtl8821ae/regd.c:200 _rtl_reg_apply_beaconing_flags()
> warn: the 'IEEE80211_CHAN_NO_IBSS' macro might need parens
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/staging/rtl8821ae/regd.h b/drivers/staging/rtl8821ae/regd.h
> index abc60ab8165c..dceb3f18200b 100644
> --- a/drivers/staging/rtl8821ae/regd.h
> +++ b/drivers/staging/rtl8821ae/regd.h
> @@ -30,8 +30,8 @@
> #ifndef __RTL_REGD_H__
> #define __RTL_REGD_H__
>
> -#define IEEE80211_CHAN_NO_IBSS 1<<2
> -#define IEEE80211_CHAN_PASSIVE_SCAN 1<<1
> +#define IEEE80211_CHAN_NO_IBSS (1 << 2)
> +#define IEEE80211_CHAN_PASSIVE_SCAN (1 << 1)
> #define WIPHY_FLAG_CUSTOM_REGULATORY BIT(0)
> #define WIPHY_FLAG_STRICT_REGULATORY BIT(1)
> #define WIPHY_FLAG_DISABLE_BEACON_HINTS BIT(2)
> --
just one minor hint ...
could we settle for a common semantic here either 1<<2 or BIT(2) ?
just my 2 cents,
re,
wh
next prev parent reply other threads:[~2014-01-28 14:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-28 14:00 [patch] staging: r8821ae: a couple macro expansion bugs Dan Carpenter
2014-01-28 14:14 ` walter harms [this message]
2014-01-28 14:46 ` Dan Carpenter
2014-01-28 15:01 ` Greg Kroah-Hartman
2014-01-28 16:25 ` Larry Finger
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=52E7BB3D.4060604@bfs.de \
--to=wharms@bfs.de \
--cc=kernel-janitors@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.