pthread_cond_many: fix uninitialized return in option handling

Message ID 1406585048-31585-1-git-send-email-gary.robertson@linaro.org
State Accepted
Commit cb76dcdd1f6156a0c40bd14e90156d0793e1b77b
Headers show

Commit Message

gary.robertson@linaro.org July 28, 2014, 10:04 p.m.
From: "Gary S. Robertson" <gary.robertson@linaro.org>

Some of the cases in the switch statement in parse_args() did not
initialize the 'handled' variable which is returned by the function.
Added an initialization to the definition of the variable.

Signed-off-by: Gary S. Robertson <gary.robertson@linaro.org>
---
 .../realtime/perf/latency/pthread_cond_many.c      |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Cyril Hrubis July 29, 2014, 10:35 a.m. | #1
Hi!
> Some of the cases in the switch statement in parse_args() did not
> initialize the 'handled' variable which is returned by the function.
> Added an initialization to the definition of the variable.

Looks good to me, pushed, thanks.

Patch

diff --git a/testcases/realtime/perf/latency/pthread_cond_many.c b/testcases/realtime/perf/latency/pthread_cond_many.c
index f9325b5..1d39100 100644
--- a/testcases/realtime/perf/latency/pthread_cond_many.c
+++ b/testcases/realtime/perf/latency/pthread_cond_many.c
@@ -256,7 +256,7 @@  void usage(void)
 
 int parse_args(int c, char *v)
 {
-	int handled;
+	int handled = 1;
 	switch (c) {
 	case 'h':
 		usage();