Skip to contentSkip to conversation

staging: rtl8192u: Modify if, else if conditions to remove unnecessary equality checks. This change was detected with the help of coccinelle tool.

PATCH In review Dhere, Chaitanya (C.) 3 participants 3 messages May 18, 2015 – May 19, 2015 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: rtl8192u: Modify if, else if conditions to remove unnecessary equality checks. This change was detected with the help of coccinelle tool.

Reply-To:

---
 drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +2 -3
index d2e8b12..30b0135 100644
@@ -1364,12 +1364,11 @@ static void ieee80211_associate_complete_wq(struct work_struct *work)
 		ieee->LinkDetectInfo.NumRecvDataInPeriod= 1;
 	}
 	ieee->link_change(ieee->dev);
-	if(ieee->is_silent_reset == 0){
+	if (!ieee->is_silent_reset) {
 		printk("============>normal associate\n");
 	notify_wx_assoc_event(ieee);
 	}
-	else if(ieee->is_silent_reset == 1)
-	{
+	else if (ieee->is_silent_reset) {
 		printk("==================>silent reset associate\n");
 		ieee->is_silent_reset = false;
 	}
Signature · 1 line
1.9.1
#1 lore raw
Quoted 1 line · Chaitanya (C.)

Your subject line is too long :(

Put some information in the change log area here please, above the signed-off-by line.

Quoted 1 line

Reply-To:

Why is this here?

Please fix up and resend.

thanks,

greg k-h

#2 lore raw
In reply to Dhere, Chaitanya (C.)
Quoted 12 lines · Chaitanya (C.)

Reply-To:

---
 drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +0 -0
index d2e8b12..30b0135 100644

drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c static void ieee80211_associate_complete_wq(struct work_struct *work) · line 1370

Quoted 8 lines
drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +1 -1
@@ -1364,12 +1364,11 @@ static void ieee80211_associate_complete_wq(struct work_struct *work)
 		ieee->LinkDetectInfo.NumRecvDataInPeriod= 1;
 	}
 	ieee->link_change(ieee->dev);
-	if(ieee->is_silent_reset == 0){
+	if (!ieee->is_silent_reset) {
 		printk("============>normal associate\n");
 	notify_wx_assoc_event(ieee);
 	}

In addition to Greg's comments, I'd ask while here, what about the misleading lack of indent on the notify_wx_assoc_event() call above? That would concern me more than trivial equality check changes that gcc will no doubt optimize to the same thing.

drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c static void ieee80211_associate_complete_wq(struct work_struct *work) · line 1371

Quoted 3 lines
drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +1 -2
-	else if(ieee->is_silent_reset == 1)
-	{
+	else if (ieee->is_silent_reset) {

But why leave the "else if" vs an "else"? You know this:

staging/rtl8192u/ieee80211/ieee80211.h: bool is_silent_reset;

and you've already tested "if (!ieee->is_silent_reset)". By definition, a bool can have only two values and you've already tested for one of them, so...

Paul.
--

Quoted 5 lines
drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +0 -0
 		printk("==================>silent reset associate\n");
 		ieee->is_silent_reset = false;
 	}
Signature · 1 line
1.9.1