diff mbox

odp_example.c: fix dead code path

Message ID 1414180691-31279-1-git-send-email-mike.holmes@linaro.org
State Accepted
Commit 39951f7312f827a756eb517c142ab2b87d18a661
Headers show

Commit Message

Mike Holmes Oct. 24, 2014, 7:58 p.m. UTC
tot is = i which cannot leave the for loop without being positive
    unless it exits entirely and never reaches the test statement.
    Or QUEUE_ROUNDS is #defined to 0 rather than (512*1024)
    Thus tot is always true and the else cannot execute

Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
---

Previous patch missed a case.

 example/odp_example/odp_example.c | 5 -----
 1 file changed, 5 deletions(-)

Comments

Maxim Uvarov Oct. 30, 2014, 10:02 p.m. UTC | #1
On 10/24/2014 11:58 PM, Mike Holmes wrote:
>      tot is = i which cannot leave the for loop without being positive
>      unless it exits entirely and never reaches the test statement.
>      Or QUEUE_ROUNDS is #defined to 0 rather than (512*1024)
>      Thus tot is always true and the else cannot execute
>
> Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
> ---
>
> Previous patch missed a case.
>
>   example/odp_example/odp_example.c | 5 -----
>   1 file changed, 5 deletions(-)
>
> diff --git a/example/odp_example/odp_example.c b/example/odp_example/odp_example.c
> index 5f25f89..ae243c8 100644
> --- a/example/odp_example/odp_example.c
> +++ b/example/odp_example/odp_example.c
> @@ -355,13 +355,8 @@ static int test_schedule_one_single(const char *str, int thr,
>   	odp_barrier_sync(barrier);
>   	clear_sched_queues();
>   
> -	if (tot) {
>   		cycles = cycles/tot;
>   		ns     = ns/tot;
> -	} else {
> -		cycles = 0;
> -		ns     = 0;
> -	}

braces removed but indent is not fixed. Please correct it.

Maxim.

>   
>   	printf("  [%i] %s enq+deq %"PRIu64" cycles, %"PRIu64" ns\n",
>   	       thr, str, cycles, ns);
diff mbox

Patch

diff --git a/example/odp_example/odp_example.c b/example/odp_example/odp_example.c
index 5f25f89..ae243c8 100644
--- a/example/odp_example/odp_example.c
+++ b/example/odp_example/odp_example.c
@@ -355,13 +355,8 @@  static int test_schedule_one_single(const char *str, int thr,
 	odp_barrier_sync(barrier);
 	clear_sched_queues();
 
-	if (tot) {
 		cycles = cycles/tot;
 		ns     = ns/tot;
-	} else {
-		cycles = 0;
-		ns     = 0;
-	}
 
 	printf("  [%i] %s enq+deq %"PRIu64" cycles, %"PRIu64" ns\n",
 	       thr, str, cycles, ns);