aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAkihiro Nagai <akihiro.nagai.hw@hitachi.com>2011-03-23 03:29:39 -0400
committerIngo Molnar <mingo@elte.hu>2011-03-23 05:38:32 -0400
commitce2d17ca7f85dcade62cd608601a0d52ccdaf0e6 (patch)
tree134a4c4a825ff765eed239df643eed5403a3614d /tools
parente1eb029081f9cd4f73bdd05d495e5011839546f5 (diff)
perf top: Fix uninitialized 'counter' variable
builtin-top.c has an uninitialized variable. gcc(version 4.5.1) warns about it and it results in build failure: builtin-top.c: In function 'display_thread': builtin-top.c:518:9: error: 'counter' may be used uninitialized This situation can indeed trigger, if the getline() call in prompt_integer() fails. Signed-off-by: Akihiro Nagai <akihiro.nagai.hw@hitachi.com> Cc: Arnaldo Carvalho de Melo <acme@infradead.org> Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> LKML-Reference: <20110323072939.11638.50173.stgit@localhost6.localdomain6> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/builtin-top.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 70f1075cc5b0..676b4fb0070f 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -515,7 +515,9 @@ static void handle_keypress(struct perf_session *session, int c)
515 break; 515 break;
516 case 'E': 516 case 'E':
517 if (top.evlist->nr_entries > 1) { 517 if (top.evlist->nr_entries > 1) {
518 int counter; 518 /* Select 0 as the default event: */
519 int counter = 0;
520
519 fprintf(stderr, "\nAvailable events:"); 521 fprintf(stderr, "\nAvailable events:");
520 522
521 list_for_each_entry(top.sym_evsel, &top.evlist->entries, node) 523 list_for_each_entry(top.sym_evsel, &top.evlist->entries, node)