* [PATCH] staging: rtl8192u: simplify conditional statement
@ 2015-10-15 12:33 Luis de Bethencourt
2015-10-15 12:56 ` Dan Carpenter
2015-10-15 15:14 ` kbuild test robot
0 siblings, 2 replies; 3+ messages in thread
From: Luis de Bethencourt @ 2015-10-15 12:33 UTC (permalink / raw)
To: linux-kernel
Cc: gregkh, devel, cristina.opriceana, shraddha.6596, hamohammed.sa,
gascoar, gdonald, paul.gortmaker, Luis de Bethencourt
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 <luisbg@osg.samsung.com>
---
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] staging: rtl8192u: simplify conditional statement
2015-10-15 12:33 [PATCH] staging: rtl8192u: simplify conditional statement Luis de Bethencourt
@ 2015-10-15 12:56 ` Dan Carpenter
2015-10-15 15:14 ` kbuild test robot
1 sibling, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2015-10-15 12:56 UTC (permalink / raw)
To: Luis de Bethencourt
Cc: linux-kernel, devel, hamohammed.sa, paul.gortmaker, gregkh,
gdonald, cristina.opriceana
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] staging: rtl8192u: simplify conditional statement
2015-10-15 12:33 [PATCH] staging: rtl8192u: simplify conditional statement Luis de Bethencourt
2015-10-15 12:56 ` Dan Carpenter
@ 2015-10-15 15:14 ` kbuild test robot
1 sibling, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2015-10-15 15:14 UTC (permalink / raw)
To: Luis de Bethencourt
Cc: kbuild-all, linux-kernel, devel, hamohammed.sa, paul.gortmaker,
gregkh, gdonald, Luis de Bethencourt, cristina.opriceana
[-- Attachment #1: Type: text/plain, Size: 2141 bytes --]
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 infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 51721 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-10-15 15:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-15 12:33 [PATCH] staging: rtl8192u: simplify conditional statement Luis de Bethencourt
2015-10-15 12:56 ` Dan Carpenter
2015-10-15 15:14 ` kbuild test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox