Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf probe: Don't use strerror if strlist__add failed

Since the strlist__add doesn't involves any IO, the failure reason must
be ENOMEM or EINVAL, moreover this is just a debug message, we don't
need to show the error string.

And also, if get_probe_trace_command_rawlist() returns NULL, it doesn't
mean the rawlist is empty, there is an error. So caller must use
-ENOMEM for the error.

Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Naohiro Aota <naota@elisp.net>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20140814022230.3545.99254.stgit@kbuild-fedora.novalocal
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Masami Hiramatsu and committed by
Arnaldo Carvalho de Melo
6eb08660 e8232f1a

+4 -2
+4 -2
tools/perf/util/probe-event.c
··· 1881 1881 p[idx] = '\0'; 1882 1882 ret = strlist__add(sl, buf); 1883 1883 if (ret < 0) { 1884 - pr_debug("strlist__add failed: %s\n", strerror(-ret)); 1884 + pr_debug("strlist__add failed (%d)\n", ret); 1885 1885 strlist__delete(sl); 1886 1886 return NULL; 1887 1887 } ··· 1940 1940 1941 1941 rawlist = get_probe_trace_command_rawlist(fd); 1942 1942 if (!rawlist) 1943 - return -ENOENT; 1943 + return -ENOMEM; 1944 1944 1945 1945 strlist__for_each(ent, rawlist) { 1946 1946 ret = parse_probe_trace_command(ent->s, &tev); ··· 2007 2007 2008 2008 memset(&tev, 0, sizeof(tev)); 2009 2009 rawlist = get_probe_trace_command_rawlist(fd); 2010 + if (!rawlist) 2011 + return NULL; 2010 2012 sl = strlist__new(true, NULL); 2011 2013 strlist__for_each(ent, rawlist) { 2012 2014 ret = parse_probe_trace_command(ent->s, &tev);