Skip to content

Commit afccc00

Browse files
Luis Henriquesrostedt
authored andcommitted
tracing: Fix tracing_stat return values in error handling paths
tracing_stat_init() was always returning '0', even on the error paths. It now returns -ENODEV if tracing_init_dentry() fails or -ENOMEM if it fails to created the 'trace_stat' debugfs directory. Link: http://lkml.kernel.org/r/1410299381-20108-1-git-send-email-luis.henriques@canonical.com Fixes: ed6f1c9 ("tracing: Check return value of tracing_init_dentry()") Signed-off-by: Luis Henriques <luis.henriques@canonical.com> [ Pulled from the archeological digging of my INBOX ] Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
1 parent dfb6cd1 commit afccc00

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

‎kernel/trace/trace_stat.c‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -280,18 +280,22 @@ static int tracing_stat_init(void)
280280

281281
d_tracing = tracing_init_dentry();
282282
if (IS_ERR(d_tracing))
283-
return 0;
283+
return -ENODEV;
284284

285285
stat_dir = tracefs_create_dir("trace_stat", d_tracing);
286-
if (!stat_dir)
286+
if (!stat_dir) {
287287
pr_warn("Could not create tracefs 'trace_stat' entry\n");
288+
return -ENOMEM;
289+
}
288290
return 0;
289291
}
290292

291293
static int init_stat_file(struct stat_session *session)
292294
{
293-
if (!stat_dir && tracing_stat_init())
294-
return -ENODEV;
295+
int ret;
296+
297+
if (!stat_dir && (ret = tracing_stat_init()))
298+
return ret;
295299

296300
session->file = tracefs_create_file(session->ts->name, 0644,
297301
stat_dir,

0 commit comments

Comments
 (0)