Skip to content

Commit 9f3c16a

Browse files
Yuuoniyacmel
authored andcommitted
perf expr: Fix return value of ids__new()
callers of ids__new() function only do NULL checking for the return value. ids__new() calles hashmap__new(), which may return ERR_PTR(-ENOMEM). Instead of changing the checking one-by-one return NULL instead of ERR_PTR(-ENOMEM) to keep it consistent. Signed-off-by: Miaoqian Lin <[email protected]> Reviewed-by: German Gomez <[email protected]> Tested-by: German Gomez <[email protected]> Acked-by: Jiri Olsa <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Ian Rogers <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: http://lore.kernel.org/lkml/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent ecf71de commit 9f3c16a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tools/perf/util/expr.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,12 @@ static bool key_equal(const void *key1, const void *key2,
6666

6767
struct hashmap *ids__new(void)
6868
{
69-
return hashmap__new(key_hash, key_equal, NULL);
69+
struct hashmap *hash;
70+
71+
hash = hashmap__new(key_hash, key_equal, NULL);
72+
if (IS_ERR(hash))
73+
return NULL;
74+
return hash;
7075
}
7176

7277
void ids__free(struct hashmap *ids)

0 commit comments

Comments
 (0)