[PATCH] perf tools: Fix error return code in cmd_buildid_cache()

From: Zhihao Cheng
Date: Thu Apr 08 2021 - 07:16:36 EST


Fix to return a negative error code from the error handling
case instead of 0, as done elsewhere in this function.

Fixes: e3ed75bb537a8 ("perf buildid-cache: Move session...")
Reported-by: Hulk Robot <hulkci@xxxxxxxxxx>
Signed-off-by: Zhihao Cheng <chengzhihao1@xxxxxxxxxx>
---
tools/perf/builtin-buildid-cache.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/perf/builtin-buildid-cache.c b/tools/perf/builtin-buildid-cache.c
index ecd0d3cb6f5c..f703ba11e12c 100644
--- a/tools/perf/builtin-buildid-cache.c
+++ b/tools/perf/builtin-buildid-cache.c
@@ -448,7 +448,8 @@ int cmd_buildid_cache(int argc, const char **argv)
return PTR_ERR(session);
}

- if (symbol__init(session ? &session->header.env : NULL) < 0)
+ ret = symbol__init(session ? &session->header.env : NULL);
+ if (ret < 0)
goto out;

setup_pager();
--
2.25.4