[PATCH] perf ftrace: Fix NULL vs IS_ERR() check in prepare_func_profile()
From: Chen Ni <hidden>
Date: 2026-03-05 02:25:18
The hashmap__new() function never returns NULL, it returns error
pointers. Fix the error checking to match.
Fixes: 0f223813edd0 ("perf ftrace: Add 'profile' command")
Signed-off-by: Chen Ni <redacted>
---
tools/perf/builtin-ftrace.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c
index 6b6eec65f93f..9e7e81a08606 100644
--- a/tools/perf/builtin-ftrace.c
+++ b/tools/perf/builtin-ftrace.c@@ -18,6 +18,7 @@ #include <poll.h> #include <ctype.h> #include <linux/capability.h> +#include <linux/err.h> #include <linux/string.h> #include <sys/stat.h>
@@ -1209,7 +1210,7 @@ static int prepare_func_profile(struct perf_ftrace *ftrace) ftrace->graph_verbose = 0; ftrace->profile_hash = hashmap__new(profile_hash, profile_equal, NULL); - if (ftrace->profile_hash == NULL) + if (IS_ERR(ftrace->profile_hash)) return -ENOMEM; return 0;
--
2.25.1