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

From: chenggang qin
Date: Sun Apr 07 2013 - 05:37:24 EST


From: <chenggang.qcg@xxxxxxxxxx>

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 <dsahern@xxxxxxxxx>
Cc: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
Cc: Paul Mackerras <paulus@xxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxxxxx>
Cc: Arnaldo Carvalho de Melo <acme@xxxxxxxxxxxxxxxxxx>
Cc: Arjan van de Ven <arjan@xxxxxxxxxxxxxxx>
Cc: Namhyung Kim <namhyung@xxxxxxxxx>
Cc: Yanmin Zhang <yanmin.zhang@xxxxxxxxx>
Cc: Wu Fengguang <fengguang.wu@xxxxxxxxx>
Cc: Mike Galbraith <efault@xxxxxx>
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Chenggang Qin <chenggang.qcg@xxxxxxxxxx>

---
tools/perf/util/trace-event-parse.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c
index 3aabcd6..630e331 100644
--- a/tools/perf/util/trace-event-parse.c
+++ b/tools/perf/util/trace-event-parse.c
@@ -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) {
--
1.5.5.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/