linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Williams <dcbw@redhat.com>
To: Roel Kluin <12o3l@tiscali.nl>
Cc: linux-wireless@vger.kernel.org
Subject: Re: [PATCH] fix 'and' typo's
Date: Fri, 26 Oct 2007 19:48:46 -0400	[thread overview]
Message-ID: <1193442527.20185.10.camel@localhost.localdomain> (raw)
In-Reply-To: <4722453E.2090801@tiscali.nl>

On Fri, 2007-10-26 at 21:51 +0200, Roel Kluin wrote:
> A few patches with changes to net code. I have sent these to the lkml
> previously, but they were not yet merged. I am fairly new to kernel 
> programming, so it is possible that I make some mistakes. I'll explain my
> rationale, please nack if incorrect, an additional bit of explanation is
> appreciated even more.
> 
> The condition '!x & y,' does make little sense: the '!' has a higher
> priority than '&'. It behaves therefore like '!x && y'. In the case 
> bitanding flags, however, '!(x & y)' appears to be desired.
> 
> Warning: the change of '!x & y,' to '!(x & y)' may change behavior. if
> not desired, I propose changing this to '!x && y', to make it explicitly
> clear.
> 
> These '&' typo's can be spotted with:
> a="A-Za-z0-9_"
> git-grep "\![^$a()]*[$a]\+\([$a.]*\|->\)*\(\[[$a.]*\]\)\?[ \W]*&[^&]\+"
> 
> --
>         Fix priority mistakes similar to '!x & y'
>     
>         Signed-off-by: Roel Kluin <12o3l@tiscali.nl>
> ---
> diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
> index 074055e..e3eca6d 100644
> --- a/drivers/net/wireless/airo.c
> +++ b/drivers/net/wireless/airo.c
> @@ -6407,7 +6407,7 @@ static int airo_set_encode(struct net_device *dev,
>  			set_wep_key(local, index, NULL, 0, perm, 1);
>  		} else
>  			/* Don't complain if only change the mode */
> -			if(!dwrq->flags & IW_ENCODE_MODE) {
> +			if(!(dwrq->flags & IW_ENCODE_MODE)) {
>  				return -EINVAL;
>  			}
>  	}

Ack.

> diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c
> index 059ce3f..57cc7e5 100644
> --- a/drivers/net/wireless/atmel.c
> +++ b/drivers/net/wireless/atmel.c
> @@ -1759,7 +1759,7 @@ static int atmel_set_encode(struct net_device *dev,
>  			priv->default_key = index;
>  		} else
>  			/* Don't complain if only change the mode */
> -			if (!dwrq->flags & IW_ENCODE_MODE) {
> +			if (!(dwrq->flags & IW_ENCODE_MODE)) {
>  				return -EINVAL;
>  			}
>  	}

Ack.

> diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c
> index c6f5aa3..d93438c 100644
> --- a/drivers/net/wireless/libertas/wext.c
> +++ b/drivers/net/wireless/libertas/wext.c
> @@ -1380,7 +1380,7 @@ static int wlan_get_encodeext(struct net_device *dev,
>  		index = adapter->wep_tx_keyidx;
>  	}
>  
> -	if (!ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY &&
> +	if (!(ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) &&
>  	    ext->alg != IW_ENCODE_ALG_WEP) {
>  		if (index != 0 || adapter->mode != IW_MODE_INFRA)
>  			goto out;

Ack.

> diff --git a/drivers/net/wireless/p54common.c b/drivers/net/wireless/p54common.c
> index 1437db0..8ee1453 100644
> --- a/drivers/net/wireless/p54common.c
> +++ b/drivers/net/wireless/p54common.c
> @@ -374,7 +374,7 @@ static void p54_rx_frame_sent(struct ieee80211_hw *dev, struct sk_buff *skb)
>  			if ((entry_hdr->magic1 & cpu_to_le16(0x4000)) != 0)
>  				pad = entry_data->align[0];
>  
> -			if (!status.control.flags & IEEE80211_TXCTL_NO_ACK) {
> +			if (!(status.control.flags & IEEE80211_TXCTL_NO_ACK)) {
>  				if (!(payload->status & 0x01))
>  					status.flags |= IEEE80211_TX_STATUS_ACK;
>  				else
> diff --git a/drivers/net/wireless/prism54/isl_ioctl.c b/drivers/net/wireless/prism54/isl_ioctl.c
> index 6d80ca4..b9d0073 100644
> --- a/drivers/net/wireless/prism54/isl_ioctl.c
> +++ b/drivers/net/wireless/prism54/isl_ioctl.c
> @@ -1118,7 +1118,7 @@ prism54_set_encode(struct net_device *ndev, struct iw_request_info *info,
>  			    mgt_set_request(priv, DOT11_OID_DEFKEYID, 0,
>  					    &index);
>  		} else {
> -			if (!dwrq->flags & IW_ENCODE_MODE) {
> +			if (!(dwrq->flags & IW_ENCODE_MODE)) {
>  				/* we cannot do anything. Complain. */
>  				return -EINVAL;
>  			}
> @@ -2610,7 +2610,7 @@ prism2_ioctl_set_encryption(struct net_device *dev,
>  			    mgt_set_request(priv, DOT11_OID_DEFKEYID, 0,
>  					    &index);
>  		} else {
> -			if (!param->u.crypt.flags & IW_ENCODE_MODE) {
> +			if (!(param->u.crypt.flags & IW_ENCODE_MODE)) {
>  				/* we cannot do anything. Complain. */
>  				return -EINVAL;
>  			}
> diff --git a/drivers/net/wireless/zd1211rw/zd_rf_uw2453.c b/drivers/net/wireless/zd1211rw/zd_rf_uw2453.c
> index 857dcf3..3c1cca4 100644
> --- a/drivers/net/wireless/zd1211rw/zd_rf_uw2453.c
> +++ b/drivers/net/wireless/zd1211rw/zd_rf_uw2453.c
> @@ -403,7 +403,7 @@ static int uw2453_init_hw(struct zd_rf *rf)
>  		if (r)
>  			return r;
>  
> -		if (!intr_status & 0xf) {
> +		if (!(intr_status & 0xf)) {
>  			dev_dbg_f(zd_chip_dev(chip),
>  				"PLL locked on configuration %d\n", i);
>  			found_config = i;
> diff --git a/net/ieee80211/ieee80211_wx.c b/net/ieee80211/ieee80211_wx.c
> index d309e8f..623489a 100644
> --- a/net/ieee80211/ieee80211_wx.c
> +++ b/net/ieee80211/ieee80211_wx.c
> @@ -709,7 +709,7 @@ int ieee80211_wx_get_encodeext(struct ieee80211_device *ieee,
>  	} else
>  		idx = ieee->tx_keyidx;
>  
> -	if (!ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY &&
> +	if (!(ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) &&
>  	    ext->alg != IW_ENCODE_ALG_WEP)
>  		if (idx != 0 || ieee->iw_mode != IW_MODE_INFRA)
>  			return -EINVAL;
> -
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


  parent reply	other threads:[~2007-10-26 23:49 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-26 19:51 [PATCH] fix 'and' typo's Roel Kluin
2007-10-26 20:06 ` [PATCH split 0/8] " Roel Kluin
2007-10-26 20:07   ` [PATCH split 1/8] fix 'and' typo's in airo wireless Roel Kluin
2007-10-26 20:09   ` [PATCH split 2/8] fix 'and' typo's in atmel wireless Roel Kluin
2007-10-26 20:12   ` [PATCH split 3/8] fix 'and' typo's in wireless/libertas/wext Roel Kluin
2007-10-26 20:13   ` [PATCH split 4/8] fix 'and' typo's in wireless/p54common Roel Kluin
2007-10-26 20:14   ` [PATCH split 5/8] fix 'and' typo's wireless/prism54/isl_ioctl (first) Roel Kluin
2007-10-29 15:11     ` Luis R. Rodriguez
2007-10-26 20:18   ` [PATCH split 6/8] fix 'and' typo's Roel Kluin
2007-10-26 20:19   ` [PATCH split 7/8] fix 'and' typo's in wireless/zd1211rw/zd_rf_uw2453 Roel Kluin
2007-10-26 20:19   ` [PATCH split 8/8] fix 'and' typo's net/ieee80211/ieee80211_wx Roel Kluin
2008-01-10 19:15   ` [PATCH wireless/arlan] Replace logical- by bit-and Roel Kluin
2008-01-10 20:28     ` Randy Dunlap
2008-01-10 20:48       ` Chuck Ebbert
2008-01-10 21:16         ` Randy Dunlap
2008-01-10 21:28           ` John W. Linville
2008-01-10 22:19       ` Roel Kluin
2007-10-26 23:48 ` Dan Williams [this message]
2007-10-27  0:05   ` [PATCH] fix 'and' typo's Roel Kluin

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=1193442527.20185.10.camel@localhost.localdomain \
    --to=dcbw@redhat.com \
    --cc=12o3l@tiscali.nl \
    --cc=linux-wireless@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;
as well as URLs for NNTP newsgroup(s).