Skip to contentSkip to conversation

perf/core: Fix a warning in util/trace-event-parse.c

PATCH New chenggang qin 1 participant 1 message Apr 7, 2013 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf/core: Fix a warning in util/trace-event-parse.c

From: <[email protected]>

While I compile the perf in Red Hat Enterprise Linux Server release 5.4 (Tikanga), I got a warning:

CC util/trace-event-parse.o
cc1: warnings being treated as errors
util/trace-event-parse.c: In function 'parse_proc_kallsyms':
util/trace-event-parse.c:232: warning: 'fmt' may be used uninitialized in this function
make: *** [util/trace-event-parse.o] Error 1

The version of gcc is: 4.1.2

The reason is that the local variable 'fmt' is not initialized before we use it. It is fixed in this patch.

Cc David Ahern <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Arjan van de Ven <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Yanmin Zhang <[email protected]>
Cc Wu Fengguang <[email protected]>
Cc Mike Galbraith <[email protected]>
Cc Andrew Morton <[email protected]>
---
 tools/perf/util/trace-event-parse.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
tools/perf/util/trace-event-parse.c +1 -1
index 3aabcd6..630e331 100644
@@ -229,7 +229,7 @@ void parse_proc_kallsyms(struct pevent *pevent,
 	char *next = NULL;
 	char *addr_str;
 	char *mod;
-	char *fmt;
+	char *fmt = NULL;
 
 	line = strtok_r(file, "\n", &next);
 	while (line) {
Signature · 1 line
1.5.5.6