perf tools: Fix a compiling error in util/map.c
authorFeng Tang <feng.tang@intel.com>
Mon, 27 Aug 2012 07:38:26 +0000 (15:38 +0800)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 20 Sep 2012 11:36:34 +0000 (08:36 -0300)
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 <feng.tang@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1346053107-11946-3-git-send-email-feng.tang@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/map.c

index b442ee49452bc95b0e00e1f5f95fd16899362b12..ead5316b3f89299f0ff372cd7ba06a96b4fd0184 100644 (file)
@@ -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);
 }