[PATCH 6/7] perf util: Hint missing file when tool tips fail to load

From: Arnaldo Carvalho de Melo
Date: Thu Apr 13 2017 - 15:36:04 EST


From: David Carrillo-Cisneros <davidcc@xxxxxxxxxx>

Besides memory allocation failure, tips.txt may fail to load because the
file is not found (a more likely cause).

Communicate that to the user in tips failure warning.

Signed-off-by: David Carrillo-Cisneros <davidcc@xxxxxxxxxx>
Acked-by: Jiri Olsa <jolsa@xxxxxxxxxx>
Cc: Alexander Shishkin <alexander.shishkin@xxxxxxxxxxxxxxx>
Cc: Andi Kleen <ak@xxxxxxxxxxxxxxx>
Cc: He Kuang <hekuang@xxxxxxxxxx>
Cc: Masami Hiramatsu <mhiramat@xxxxxxxxxx>
Cc: Paul Turner <pjt@xxxxxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Cc: Simon Que <sque@xxxxxxxxxxxx>
Cc: Stephane Eranian <eranian@xxxxxxxxxx>
Cc: Wang Nan <wangnan0@xxxxxxxxxx>
Link: http://lkml.kernel.org/r/20170412064919.92449-5-davidcc@xxxxxxxxxx
Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
---
tools/perf/util/util.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
index d8b45cea54d0..6097d87429e2 100644
--- a/tools/perf/util/util.c
+++ b/tools/perf/util/util.c
@@ -696,7 +696,8 @@ const char *perf_tip(const char *dirpath)

tips = strlist__new("tips.txt", &conf);
if (tips == NULL)
- return errno == ENOENT ? NULL : "Tip: get more memory! ;-p";
+ return errno == ENOENT ? NULL :
+ "Tip: check path of tips.txt or get more memory! ;-p";

if (strlist__nr_entries(tips) == 0)
goto out;
--
2.9.3