diff mbox

[OPW,kernel] staging:rtl8192u: Removed assignments from if statements.

Message ID 1394367600-23474-1-git-send-email-fempsci@gmail.com
State New, archived
Headers show

Commit Message

Chi Pham March 9, 2014, 12:20 p.m. UTC
Signed-off-by: Chi Pham <fempsci@gmail.com>
---
 .../staging/rtl8192u/ieee80211/ieee80211_softmac.c |    6 ++++--
 drivers/staging/rtl8192u/r8192U_core.c             |    3 ++-
 2 files changed, 6 insertions(+), 3 deletions(-)

Comments

Julia Lawall March 9, 2014, 12:55 p.m. UTC | #1
On Sun, 9 Mar 2014, Chi Pham wrote:

> Signed-off-by: Chi Pham <fempsci@gmail.com>
> ---
>  .../staging/rtl8192u/ieee80211/ieee80211_softmac.c |    6 ++++--
>  drivers/staging/rtl8192u/r8192U_core.c             |    3 ++-
>  2 files changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
> index 662c7e4..adb2bed 100644
> --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
> +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
> @@ -1959,7 +1959,8 @@ ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
>  			struct ieee80211_network network_resp;
>  			struct ieee80211_network *network = &network_resp;
>
> -			if (0 == (errcode=assoc_parse(ieee,skb, &aid))){
> +			errcode = assoc_parse(ieee, skb, &aid);
> +			if (0 == errcode) {

I think that if (errcode == 0) would be more common in kernel code.

The following command gives only 609 results:

grep -r "0 == " * | grep -v "[A-Za-z0-9_]0"

A grep for "== 0" gives over 34 000.

julia

>  				ieee->state=IEEE80211_LINKED;
>  				ieee->assoc_id = aid;
>  				ieee->softmac_stats.rx_ass_ok++;
> @@ -2017,7 +2018,8 @@ ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
>
>  					IEEE80211_DEBUG_MGMT("Received authentication response");
>
> -					if (0 == (errcode=auth_parse(skb, &challenge, &chlen))){
> +					errcode = auth_parse(skb, &challenge, &chlen);
> +					if (0 == errcode) {
>  						if(ieee->open_wep || !challenge){
>  							ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATED;
>  							ieee->softmac_stats.rx_auth_rs_ok++;
> diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c
> index a56be79..3fd61f9 100644
> --- a/drivers/staging/rtl8192u/r8192U_core.c
> +++ b/drivers/staging/rtl8192u/r8192U_core.c
> @@ -1318,7 +1318,8 @@ static void rtl8192_tx_isr(struct urb *tx_urb)
>  		/* Don't send data frame during scanning.*/
>  		if ((skb_queue_len(&priv->ieee80211->skb_waitQ[queue_index]) != 0) &&
>  		    (!(priv->ieee80211->queue_stop))) {
> -			if (NULL != (skb = skb_dequeue(&(priv->ieee80211->skb_waitQ[queue_index]))))
> +			skb = skb_dequeue(&(priv->ieee80211->skb_waitQ[queue_index]));
> +			if (NULL != skb)
>  				priv->ieee80211->softmac_hard_start_xmit(skb, dev);
>
>  			return; //modified by david to avoid further processing AMSDU
> --
> 1.7.9.5
>
> --
> You received this message because you are subscribed to the Google Groups "opw-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to opw-kernel+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
Paul E. McKenney March 10, 2014, 3:13 p.m. UTC | #2
On Sun, Mar 09, 2014 at 01:20:00PM +0100, Chi Pham wrote:

You do need a commit log message, then a blank line, then your
Signed-off-by.  If you used a Coccinelle script for this, it would
be good to put that script here, including the variable declarations.

> Signed-off-by: Chi Pham <fempsci@gmail.com>
> ---
>  .../staging/rtl8192u/ieee80211/ieee80211_softmac.c |    6 ++++--
>  drivers/staging/rtl8192u/r8192U_core.c             |    3 ++-
>  2 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
> index 662c7e4..adb2bed 100644
> --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
> +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
> @@ -1959,7 +1959,8 @@ ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
>  			struct ieee80211_network network_resp;
>  			struct ieee80211_network *network = &network_resp;
> 
> -			if (0 == (errcode=assoc_parse(ieee,skb, &aid))){
> +			errcode = assoc_parse(ieee, skb, &aid);
> +			if (0 == errcode) {

"!errcode"

>  				ieee->state=IEEE80211_LINKED;
>  				ieee->assoc_id = aid;
>  				ieee->softmac_stats.rx_ass_ok++;
> @@ -2017,7 +2018,8 @@ ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
> 
>  					IEEE80211_DEBUG_MGMT("Received authentication response");
> 
> -					if (0 == (errcode=auth_parse(skb, &challenge, &chlen))){
> +					errcode = auth_parse(skb, &challenge, &chlen);
> +					if (0 == errcode) {
>  						if(ieee->open_wep || !challenge){
>  							ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATED;
>  							ieee->softmac_stats.rx_auth_rs_ok++;
> diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c
> index a56be79..3fd61f9 100644
> --- a/drivers/staging/rtl8192u/r8192U_core.c
> +++ b/drivers/staging/rtl8192u/r8192U_core.c
> @@ -1318,7 +1318,8 @@ static void rtl8192_tx_isr(struct urb *tx_urb)
>  		/* Don't send data frame during scanning.*/
>  		if ((skb_queue_len(&priv->ieee80211->skb_waitQ[queue_index]) != 0) &&
>  		    (!(priv->ieee80211->queue_stop))) {
> -			if (NULL != (skb = skb_dequeue(&(priv->ieee80211->skb_waitQ[queue_index]))))
> +			skb = skb_dequeue(&(priv->ieee80211->skb_waitQ[queue_index]));
> +			if (NULL != skb)

"skb"

							Thanx, Paul

>  				priv->ieee80211->softmac_hard_start_xmit(skb, dev);
> 
>  			return; //modified by david to avoid further processing AMSDU
> -- 
> 1.7.9.5
> 
> -- 
> You received this message because you are subscribed to the Google Groups "opw-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to opw-kernel+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
diff mbox

Patch

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
index 662c7e4..adb2bed 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
@@ -1959,7 +1959,8 @@  ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
 			struct ieee80211_network network_resp;
 			struct ieee80211_network *network = &network_resp;
 
-			if (0 == (errcode=assoc_parse(ieee,skb, &aid))){
+			errcode = assoc_parse(ieee, skb, &aid);
+			if (0 == errcode) {
 				ieee->state=IEEE80211_LINKED;
 				ieee->assoc_id = aid;
 				ieee->softmac_stats.rx_ass_ok++;
@@ -2017,7 +2018,8 @@  ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
 
 					IEEE80211_DEBUG_MGMT("Received authentication response");
 
-					if (0 == (errcode=auth_parse(skb, &challenge, &chlen))){
+					errcode = auth_parse(skb, &challenge, &chlen);
+					if (0 == errcode) {
 						if(ieee->open_wep || !challenge){
 							ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATED;
 							ieee->softmac_stats.rx_auth_rs_ok++;
diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c
index a56be79..3fd61f9 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -1318,7 +1318,8 @@  static void rtl8192_tx_isr(struct urb *tx_urb)
 		/* Don't send data frame during scanning.*/
 		if ((skb_queue_len(&priv->ieee80211->skb_waitQ[queue_index]) != 0) &&
 		    (!(priv->ieee80211->queue_stop))) {
-			if (NULL != (skb = skb_dequeue(&(priv->ieee80211->skb_waitQ[queue_index]))))
+			skb = skb_dequeue(&(priv->ieee80211->skb_waitQ[queue_index]));
+			if (NULL != skb)
 				priv->ieee80211->softmac_hard_start_xmit(skb, dev);
 
 			return; //modified by david to avoid further processing AMSDU