From: Han Pingtian <phan@redhat.com>
Date: Fri, 14 Jan 2011 23:00:50 +0000 (+0800)
Subject: perf test: check if cpu_map__new() return NULL
X-Git-Tag: firefly_0821_release~7613^2~2238^2~114^2~15
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=98d77b78504a423fca911a26a17bee00ef2fdda2;p=firefly-linux-kernel-4.4.55.git

perf test: check if cpu_map__new() return NULL

It looks like we should check if cpus is NULL after

	cpus = cpu_map__new(NULL);

in test__open_syscall_event_on_all_cpus().

LKML-Reference: <20110114230050.GA7011@localhost>
Signed-off-by: Han Pingtian <phan@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---

diff --git a/tools/perf/builtin-test.c b/tools/perf/builtin-test.c
index 7cc6b2086947..5a50e4755e6c 100644
--- a/tools/perf/builtin-test.c
+++ b/tools/perf/builtin-test.c
@@ -347,9 +347,9 @@ static int test__open_syscall_event_on_all_cpus(void)
 	}
 
 	cpus = cpu_map__new(NULL);
-	if (threads == NULL) {
-		pr_debug("thread_map__new\n");
-		return -1;
+	if (cpus == NULL) {
+		pr_debug("cpu_map__new\n");
+		goto out_thread_map_delete;
 	}