Re: [PATCH] staging: rtl8192u: simplify conditional statement
Hi Luis, [auto build test WARNING on staging/staging-next -- if it's inappropriate base, please suggest rules for selecting the more suitable base] url: https://github.com/0day-ci/linux/commits/Luis-de-Bethencourt/staging-rtl8192u-simplify-conditional-statement/20151015-203425 config: i386-allmodconfig (attached as .config) reproduce: # save the attached .config to linux build tree make ARCH=i386 All warnings (new ones prefixed by >>): drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c: In function 'ieee80211_softmac_scan_syncro_rsl': >> drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c:469:19: warning: >> comparison of constant '5' with boolean expression is always false >> [-Wbool-compare] if(!ieee->state > IEEE80211_LINKED && ieee->sync_scan_hurryup) ^ >> drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c:469:19: warning: >> logical not is only applied to the left hand side of comparison >> [-Wlogical-not-parentheses] vim +/5 +469 drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c 453 *new network events, despite for updating the net list, 454 *but we are temporarly 'unlinked' as the driver shall 455 *not filter RX frames and the channel is changing. 456 * So the only situation in witch are interested is to check 457 * if the state become LINKED because of the #1 situation 458 */ 459 460 if (ieee->state == IEEE80211_LINKED) 461 goto out; 462 ieee->set_chan(ieee->dev, ch); 463 if(channel_map[ch] == 1) 464 ieee80211_send_probe_requests(ieee); 465 466 /* this prevent excessive time wait when we 467 * need to wait for a syncro scan to end.. 468 */ > 469 if(!ieee->state > IEEE80211_LINKED && > ieee->sync_scan_hurryup) 470 goto out; 471 472 473 msleep_interruptible_rsl(IEEE80211_SOFTMAC_SCAN_TIME); 474 475 } 476 out: 477 if(ieee->state < IEEE80211_LINKED){ --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: Binary data
Re: [PATCH] staging: rtl8192u: simplify conditional statement
On Thu, Oct 15, 2015 at 01:33:14PM +0100, Luis de Bethencourt wrote: > diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c > b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c > index c443e2e..1c2d1a4 100644 > --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c > +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c > @@ -466,10 +466,7 @@ void ieee80211_softmac_scan_syncro(struct > ieee80211_device *ieee) > /* this prevent excessive time wait when we >* need to wait for a syncro scan to end.. >*/ > - if(ieee->state < IEEE80211_LINKED) > - ; > - else > - if (ieee->sync_scan_hurryup) > + if(!ieee->state > IEEE80211_LINKED && ieee->sync_scan_hurryup) The precedence is wrong here. What you wrote is equivalent to: if ((!ieee->state) > IEEE80211_LINKED) goto out; Which can never be true. Also use checkpatch.pl on your patches before sending. regards, dan carpenter -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] staging: rtl8192u: simplify conditional statement
The code can be much cleaner and readable by simplifying the conditional statement. Only need to check if (ieee->state > IEEE80211_LINKED) and not >= because (ieee->state == IEEE80211_LINKED) is already checked a few lines above. Signed-off-by: Luis de Bethencourt --- drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c index c443e2e..1c2d1a4 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c @@ -466,10 +466,7 @@ void ieee80211_softmac_scan_syncro(struct ieee80211_device *ieee) /* this prevent excessive time wait when we * need to wait for a syncro scan to end.. */ - if(ieee->state < IEEE80211_LINKED) - ; - else - if (ieee->sync_scan_hurryup) + if(!ieee->state > IEEE80211_LINKED && ieee->sync_scan_hurryup) goto out; -- 2.5.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] staging: rtl8192u: simplify conditional statement
On Thu, Oct 15, 2015 at 01:33:14PM +0100, Luis de Bethencourt wrote: > diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c > b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c > index c443e2e..1c2d1a4 100644 > --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c > +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c > @@ -466,10 +466,7 @@ void ieee80211_softmac_scan_syncro(struct > ieee80211_device *ieee) > /* this prevent excessive time wait when we >* need to wait for a syncro scan to end.. >*/ > - if(ieee->state < IEEE80211_LINKED) > - ; > - else > - if (ieee->sync_scan_hurryup) > + if(!ieee->state > IEEE80211_LINKED && ieee->sync_scan_hurryup) The precedence is wrong here. What you wrote is equivalent to: if ((!ieee->state) > IEEE80211_LINKED) goto out; Which can never be true. Also use checkpatch.pl on your patches before sending. regards, dan carpenter -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] staging: rtl8192u: simplify conditional statement
The code can be much cleaner and readable by simplifying the conditional statement. Only need to check if (ieee->state > IEEE80211_LINKED) and not >= because (ieee->state == IEEE80211_LINKED) is already checked a few lines above. Signed-off-by: Luis de Bethencourt--- drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c index c443e2e..1c2d1a4 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c @@ -466,10 +466,7 @@ void ieee80211_softmac_scan_syncro(struct ieee80211_device *ieee) /* this prevent excessive time wait when we * need to wait for a syncro scan to end.. */ - if(ieee->state < IEEE80211_LINKED) - ; - else - if (ieee->sync_scan_hurryup) + if(!ieee->state > IEEE80211_LINKED && ieee->sync_scan_hurryup) goto out; -- 2.5.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] staging: rtl8192u: simplify conditional statement
Hi Luis, [auto build test WARNING on staging/staging-next -- if it's inappropriate base, please suggest rules for selecting the more suitable base] url: https://github.com/0day-ci/linux/commits/Luis-de-Bethencourt/staging-rtl8192u-simplify-conditional-statement/20151015-203425 config: i386-allmodconfig (attached as .config) reproduce: # save the attached .config to linux build tree make ARCH=i386 All warnings (new ones prefixed by >>): drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c: In function 'ieee80211_softmac_scan_syncro_rsl': >> drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c:469:19: warning: >> comparison of constant '5' with boolean expression is always false >> [-Wbool-compare] if(!ieee->state > IEEE80211_LINKED && ieee->sync_scan_hurryup) ^ >> drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c:469:19: warning: >> logical not is only applied to the left hand side of comparison >> [-Wlogical-not-parentheses] vim +/5 +469 drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c 453 *new network events, despite for updating the net list, 454 *but we are temporarly 'unlinked' as the driver shall 455 *not filter RX frames and the channel is changing. 456 * So the only situation in witch are interested is to check 457 * if the state become LINKED because of the #1 situation 458 */ 459 460 if (ieee->state == IEEE80211_LINKED) 461 goto out; 462 ieee->set_chan(ieee->dev, ch); 463 if(channel_map[ch] == 1) 464 ieee80211_send_probe_requests(ieee); 465 466 /* this prevent excessive time wait when we 467 * need to wait for a syncro scan to end.. 468 */ > 469 if(!ieee->state > IEEE80211_LINKED && > ieee->sync_scan_hurryup) 470 goto out; 471 472 473 msleep_interruptible_rsl(IEEE80211_SOFTMAC_SCAN_TIME); 474 475 } 476 out: 477 if(ieee->state < IEEE80211_LINKED){ --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: Binary data