From 8f28f19a87cb48d13570ba774a3e85776eb36bb4 Mon Sep 17 00:00:00 2001 From: Feng Tang Date: Mon, 27 Aug 2012 15:38:26 +0800 Subject: [PATCH] perf tools: Fix a compiling error in util/map.c MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This patch fix a compile warning taken as error: CC util/map.o cc1: warnings being treated as errors util/map.c: In function ‘map__fprintf_dsoname’: util/map.c:240: error: ‘dsoname’ may be used uninitialized in this function make: *** [util/map.o] Error 1 Signed-off-by: Feng Tang Cc: David Ahern Cc: Ingo Molnar Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/1346053107-11946-3-git-send-email-feng.tang@intel.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/map.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c index b442ee49452b..ead5316b3f89 100644 --- a/tools/perf/util/map.c +++ b/tools/perf/util/map.c @@ -243,15 +243,14 @@ size_t map__fprintf(struct map *self, FILE *fp) size_t map__fprintf_dsoname(struct map *map, FILE *fp) { - const char *dsoname; + const char *dsoname = "[unknown]"; if (map && map->dso && (map->dso->name || map->dso->long_name)) { if (symbol_conf.show_kernel_path && map->dso->long_name) dsoname = map->dso->long_name; else if (map->dso->name) dsoname = map->dso->name; - } else - dsoname = "[unknown]"; + } return fprintf(fp, "%s", dsoname); } -- 2.39.5