aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung.kim@lge.com>2013-03-21 03:18:44 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2013-03-21 12:09:42 -0400
commit454f8c7d26fa7e1545df4efca5d9ba929ccef1e8 (patch)
treeac0892882d9293d62c1e0fdaee08f3b250f67a12 /tools/perf
parent62baca8aed636eb10f9274761aa1dcbfd48a7caa (diff)
perf tools: Let get_tracing_file() return NULL to indicate failure.
So that it can be used by other places. Signed-off-by: Namhyung Kim <namhyung@kernel.org> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Steven Rostedt <rostedt@goodmis.org> Link: http://lkml.kernel.org/r/1363850332-25297-2-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/util/trace-event-info.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/tools/perf/util/trace-event-info.c b/tools/perf/util/trace-event-info.c
index 5729f434c5b1..81c673282ed4 100644
--- a/tools/perf/util/trace-event-info.c
+++ b/tools/perf/util/trace-event-info.c
@@ -62,7 +62,7 @@ static const char *find_debugfs(void)
62 const char *path = perf_debugfs_mount(NULL); 62 const char *path = perf_debugfs_mount(NULL);
63 63
64 if (!path) 64 if (!path)
65 die("Your kernel not support debugfs filesystem"); 65 pr_debug("Your kernel does not support the debugfs filesystem");
66 66
67 return path; 67 return path;
68} 68}
@@ -81,8 +81,12 @@ static const char *find_tracing_dir(void)
81 return tracing; 81 return tracing;
82 82
83 debugfs = find_debugfs(); 83 debugfs = find_debugfs();
84 if (!debugfs)
85 return NULL;
84 86
85 tracing = malloc_or_die(strlen(debugfs) + 9); 87 tracing = malloc(strlen(debugfs) + 9);
88 if (!tracing)
89 return NULL;
86 90
87 sprintf(tracing, "%s/tracing", debugfs); 91 sprintf(tracing, "%s/tracing", debugfs);
88 92
@@ -99,7 +103,9 @@ static char *get_tracing_file(const char *name)
99 if (!tracing) 103 if (!tracing)
100 return NULL; 104 return NULL;
101 105
102 file = malloc_or_die(strlen(tracing) + strlen(name) + 2); 106 file = malloc(strlen(tracing) + strlen(name) + 2);
107 if (!file)
108 return NULL;
103 109
104 sprintf(file, "%s/%s", tracing, name); 110 sprintf(file, "%s/%s", tracing, name);
105 return file; 111 return file;
@@ -170,6 +176,9 @@ static void read_header_files(void)
170 struct stat st; 176 struct stat st;
171 177
172 path = get_tracing_file("events/header_page"); 178 path = get_tracing_file("events/header_page");
179 if (!path)
180 die("can't get tracing/events/header_page");
181
173 if (stat(path, &st) < 0) 182 if (stat(path, &st) < 0)
174 die("can't read '%s'", path); 183 die("can't read '%s'", path);
175 184
@@ -178,6 +187,9 @@ static void read_header_files(void)
178 put_tracing_file(path); 187 put_tracing_file(path);
179 188
180 path = get_tracing_file("events/header_event"); 189 path = get_tracing_file("events/header_event");
190 if (!path)
191 die("can't get tracing/events/header_event");
192
181 if (stat(path, &st) < 0) 193 if (stat(path, &st) < 0)
182 die("can't read '%s'", path); 194 die("can't read '%s'", path);
183 195
@@ -251,6 +263,8 @@ static void read_ftrace_files(struct tracepoint_path *tps)
251 char *path; 263 char *path;
252 264
253 path = get_tracing_file("events/ftrace"); 265 path = get_tracing_file("events/ftrace");
266 if (!path)
267 die("can't get tracing/events/ftrace");
254 268
255 copy_event_system(path, tps); 269 copy_event_system(path, tps);
256 270
@@ -279,6 +293,8 @@ static void read_event_files(struct tracepoint_path *tps)
279 int ret; 293 int ret;
280 294
281 path = get_tracing_file("events"); 295 path = get_tracing_file("events");
296 if (!path)
297 die("can't get tracing/events");
282 298
283 dir = opendir(path); 299 dir = opendir(path);
284 if (!dir) 300 if (!dir)
@@ -343,6 +359,9 @@ static void read_ftrace_printk(void)
343 int ret; 359 int ret;
344 360
345 path = get_tracing_file("printk_formats"); 361 path = get_tracing_file("printk_formats");
362 if (!path)
363 die("can't get tracing/printk_formats");
364
346 ret = stat(path, &st); 365 ret = stat(path, &st);
347 if (ret < 0) { 366 if (ret < 0) {
348 /* not found */ 367 /* not found */