* [PATCH] staging: wilc1000: removes redundant 'continue' in while loop conditional blocks
@ 2017-03-08 4:03 Tahia Khan
2017-03-08 9:15 ` [Outreachy kernel] " Julia Lawall
0 siblings, 1 reply; 4+ messages in thread
From: Tahia Khan @ 2017-03-08 4:03 UTC (permalink / raw)
To: outreachy-kernel, aditya.shankar, ganesh.krishna, gregkh
Removing 6 continue statements from a while loop. The
continue statements are redundant here since control
already returns to the beginning of the loop upon exit
of any of the conditional blocks.
Signed-off-by: Tahia Khan <tahia.khan@gmail.com>
---
drivers/staging/wilc1000/host_interface.c | 7 -------
1 file changed, 7 deletions(-)
diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 2429c85..fdd902f 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -3890,7 +3890,6 @@ static void *host_int_ParseJoinBssParam(struct network_info *ptstrNetworkInfo)
pNewJoinBssParam->supp_rates[i + 1] = pu8IEs[index + i];
index += suppRatesNo;
- continue;
} else if (pu8IEs[index] == EXT_SUPP_RATES_IE) {
extSuppRatesNo = pu8IEs[index + 1];
if (extSuppRatesNo > (MAX_RATES_SUPPORTED - suppRatesNo))
@@ -3902,11 +3901,9 @@ static void *host_int_ParseJoinBssParam(struct network_info *ptstrNetworkInfo)
pNewJoinBssParam->supp_rates[suppRatesNo + i + 1] = pu8IEs[index + i];
index += extSuppRatesNo;
- continue;
} else if (pu8IEs[index] == HT_CAPABILITY_IE) {
pNewJoinBssParam->ht_capable = true;
index += pu8IEs[index + 1] + 2;
- continue;
} else if ((pu8IEs[index] == WMM_IE) &&
(pu8IEs[index + 2] == 0x00) && (pu8IEs[index + 3] == 0x50) &&
(pu8IEs[index + 4] == 0xF2) &&
@@ -3918,7 +3915,6 @@ static void *host_int_ParseJoinBssParam(struct network_info *ptstrNetworkInfo)
if (pu8IEs[index + 8] & BIT(7))
pNewJoinBssParam->uapsd_cap = true;
index += pu8IEs[index + 1] + 2;
- continue;
} else if ((pu8IEs[index] == P2P_IE) &&
(pu8IEs[index + 2] == 0x50) && (pu8IEs[index + 3] == 0x6f) &&
(pu8IEs[index + 4] == 0x9a) &&
@@ -3948,8 +3944,6 @@ static void *host_int_ParseJoinBssParam(struct network_info *ptstrNetworkInfo)
memcpy(pNewJoinBssParam->start_time, pu8IEs + u16P2P_count, 4);
index += pu8IEs[index + 1] + 2;
- continue;
-
} else if ((pu8IEs[index] == RSN_IE) ||
((pu8IEs[index] == WPA_IE) && (pu8IEs[index + 2] == 0x00) &&
(pu8IEs[index + 3] == 0x50) && (pu8IEs[index + 4] == 0xF2) &&
@@ -3995,7 +3989,6 @@ static void *host_int_ParseJoinBssParam(struct network_info *ptstrNetworkInfo)
}
pNewJoinBssParam->rsn_found = true;
index += pu8IEs[index + 1] + 2;
- continue;
} else {
index += pu8IEs[index + 1] + 2;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Outreachy kernel] [PATCH] staging: wilc1000: removes redundant 'continue' in while loop conditional blocks
2017-03-08 4:03 [PATCH] staging: wilc1000: removes redundant 'continue' in while loop conditional blocks Tahia Khan
@ 2017-03-08 9:15 ` Julia Lawall
2017-03-08 14:28 ` Tahia Khan
0 siblings, 1 reply; 4+ messages in thread
From: Julia Lawall @ 2017-03-08 9:15 UTC (permalink / raw)
To: Tahia Khan; +Cc: outreachy-kernel, aditya.shankar, ganesh.krishna, gregkh
On Tue, 7 Mar 2017, Tahia Khan wrote:
> Removing 6 continue statements from a while loop. The
> continue statements are redundant here since control
> already returns to the beginning of the loop upon exit
> of any of the conditional blocks.
Good observation. How did you find it?
julia
>
> Signed-off-by: Tahia Khan <tahia.khan@gmail.com>
> ---
> drivers/staging/wilc1000/host_interface.c | 7 -------
> 1 file changed, 7 deletions(-)
>
> diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
> index 2429c85..fdd902f 100644
> --- a/drivers/staging/wilc1000/host_interface.c
> +++ b/drivers/staging/wilc1000/host_interface.c
> @@ -3890,7 +3890,6 @@ static void *host_int_ParseJoinBssParam(struct network_info *ptstrNetworkInfo)
> pNewJoinBssParam->supp_rates[i + 1] = pu8IEs[index + i];
>
> index += suppRatesNo;
> - continue;
> } else if (pu8IEs[index] == EXT_SUPP_RATES_IE) {
> extSuppRatesNo = pu8IEs[index + 1];
> if (extSuppRatesNo > (MAX_RATES_SUPPORTED - suppRatesNo))
> @@ -3902,11 +3901,9 @@ static void *host_int_ParseJoinBssParam(struct network_info *ptstrNetworkInfo)
> pNewJoinBssParam->supp_rates[suppRatesNo + i + 1] = pu8IEs[index + i];
>
> index += extSuppRatesNo;
> - continue;
> } else if (pu8IEs[index] == HT_CAPABILITY_IE) {
> pNewJoinBssParam->ht_capable = true;
> index += pu8IEs[index + 1] + 2;
> - continue;
> } else if ((pu8IEs[index] == WMM_IE) &&
> (pu8IEs[index + 2] == 0x00) && (pu8IEs[index + 3] == 0x50) &&
> (pu8IEs[index + 4] == 0xF2) &&
> @@ -3918,7 +3915,6 @@ static void *host_int_ParseJoinBssParam(struct network_info *ptstrNetworkInfo)
> if (pu8IEs[index + 8] & BIT(7))
> pNewJoinBssParam->uapsd_cap = true;
> index += pu8IEs[index + 1] + 2;
> - continue;
> } else if ((pu8IEs[index] == P2P_IE) &&
> (pu8IEs[index + 2] == 0x50) && (pu8IEs[index + 3] == 0x6f) &&
> (pu8IEs[index + 4] == 0x9a) &&
> @@ -3948,8 +3944,6 @@ static void *host_int_ParseJoinBssParam(struct network_info *ptstrNetworkInfo)
> memcpy(pNewJoinBssParam->start_time, pu8IEs + u16P2P_count, 4);
>
> index += pu8IEs[index + 1] + 2;
> - continue;
> -
> } else if ((pu8IEs[index] == RSN_IE) ||
> ((pu8IEs[index] == WPA_IE) && (pu8IEs[index + 2] == 0x00) &&
> (pu8IEs[index + 3] == 0x50) && (pu8IEs[index + 4] == 0xF2) &&
> @@ -3995,7 +3989,6 @@ static void *host_int_ParseJoinBssParam(struct network_info *ptstrNetworkInfo)
> }
> pNewJoinBssParam->rsn_found = true;
> index += pu8IEs[index + 1] + 2;
> - continue;
> } else {
> index += pu8IEs[index + 1] + 2;
> }
> --
> 2.7.4
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20170308040328.GA24535%40coolbox.
> For more options, visit https://groups.google.com/d/optout.
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Outreachy kernel] [PATCH] staging: wilc1000: removes redundant 'continue' in while loop conditional blocks
2017-03-08 9:15 ` [Outreachy kernel] " Julia Lawall
@ 2017-03-08 14:28 ` Tahia Khan
2017-03-08 14:34 ` Julia Lawall
0 siblings, 1 reply; 4+ messages in thread
From: Tahia Khan @ 2017-03-08 14:28 UTC (permalink / raw)
To: Julia Lawall; +Cc: outreachy-kernel, aditya.shankar, ganesh.krishna, gregkh
On Wed, Mar 08, 2017 at 10:15:04AM +0100, Julia Lawall wrote:
> On Tue, 7 Mar 2017, Tahia Khan wrote:
>
> > Removing 6 continue statements from a while loop. The
> > continue statements are redundant here since control
> > already returns to the beginning of the loop upon exit
> > of any of the conditional blocks.
>
> Good observation. How did you find it?
>
> julia
>
> >
> > Signed-off-by: Tahia Khan <tahia.khan@gmail.com>
> > ---
> > drivers/staging/wilc1000/host_interface.c | 7 -------
> > 1 file changed, 7 deletions(-)
> >
> > diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
> > index 2429c85..fdd902f 100644
> > --- a/drivers/staging/wilc1000/host_interface.c
> > +++ b/drivers/staging/wilc1000/host_interface.c
> > @@ -3890,7 +3890,6 @@ static void *host_int_ParseJoinBssParam(struct network_info *ptstrNetworkInfo)
> > pNewJoinBssParam->supp_rates[i + 1] = pu8IEs[index + i];
> >
> > index += suppRatesNo;
> > - continue;
> > } else if (pu8IEs[index] == EXT_SUPP_RATES_IE) {
> > extSuppRatesNo = pu8IEs[index + 1];
> > if (extSuppRatesNo > (MAX_RATES_SUPPORTED - suppRatesNo))
> > @@ -3902,11 +3901,9 @@ static void *host_int_ParseJoinBssParam(struct network_info *ptstrNetworkInfo)
> > pNewJoinBssParam->supp_rates[suppRatesNo + i + 1] = pu8IEs[index + i];
> >
> > index += extSuppRatesNo;
> > - continue;
> > } else if (pu8IEs[index] == HT_CAPABILITY_IE) {
> > pNewJoinBssParam->ht_capable = true;
> > index += pu8IEs[index + 1] + 2;
> > - continue;
> > } else if ((pu8IEs[index] == WMM_IE) &&
> > (pu8IEs[index + 2] == 0x00) && (pu8IEs[index + 3] == 0x50) &&
> > (pu8IEs[index + 4] == 0xF2) &&
> > @@ -3918,7 +3915,6 @@ static void *host_int_ParseJoinBssParam(struct network_info *ptstrNetworkInfo)
> > if (pu8IEs[index + 8] & BIT(7))
> > pNewJoinBssParam->uapsd_cap = true;
> > index += pu8IEs[index + 1] + 2;
> > - continue;
> > } else if ((pu8IEs[index] == P2P_IE) &&
> > (pu8IEs[index + 2] == 0x50) && (pu8IEs[index + 3] == 0x6f) &&
> > (pu8IEs[index + 4] == 0x9a) &&
> > @@ -3948,8 +3944,6 @@ static void *host_int_ParseJoinBssParam(struct network_info *ptstrNetworkInfo)
> > memcpy(pNewJoinBssParam->start_time, pu8IEs + u16P2P_count, 4);
> >
> > index += pu8IEs[index + 1] + 2;
> > - continue;
> > -
> > } else if ((pu8IEs[index] == RSN_IE) ||
> > ((pu8IEs[index] == WPA_IE) && (pu8IEs[index + 2] == 0x00) &&
> > (pu8IEs[index + 3] == 0x50) && (pu8IEs[index + 4] == 0xF2) &&
> > @@ -3995,7 +3989,6 @@ static void *host_int_ParseJoinBssParam(struct network_info *ptstrNetworkInfo)
> > }
> > pNewJoinBssParam->rsn_found = true;
> > index += pu8IEs[index + 1] + 2;
> > - continue;
> > } else {
> > index += pu8IEs[index + 1] + 2;
> > }
> > --
> > 2.7.4
> >
> > --
> > You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> > To post to this group, send email to outreachy-kernel@googlegroups.com.
> > To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20170308040328.GA24535%40coolbox.
> > For more options, visit https://groups.google.com/d/optout.
> >
I found this using Coccinelle - which I should have noted
in my commit message! Would you suggest revising the commit
message?
Tahia
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Outreachy kernel] [PATCH] staging: wilc1000: removes redundant 'continue' in while loop conditional blocks
2017-03-08 14:28 ` Tahia Khan
@ 2017-03-08 14:34 ` Julia Lawall
0 siblings, 0 replies; 4+ messages in thread
From: Julia Lawall @ 2017-03-08 14:34 UTC (permalink / raw)
To: Tahia Khan; +Cc: outreachy-kernel, aditya.shankar, ganesh.krishna, gregkh
> I found this using Coccinelle - which I should have noted
> in my commit message! Would you suggest revising the commit
> message?
You can say "Found using Coccinelle". Or if you like you can show the
rule that you used.
julia
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-03-08 14:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-08 4:03 [PATCH] staging: wilc1000: removes redundant 'continue' in while loop conditional blocks Tahia Khan
2017-03-08 9:15 ` [Outreachy kernel] " Julia Lawall
2017-03-08 14:28 ` Tahia Khan
2017-03-08 14:34 ` Julia Lawall
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.