From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755629Ab0ESCIc (ORCPT ); Tue, 18 May 2010 22:08:32 -0400 Received: from bombadil.infradead.org ([18.85.46.34]:59148 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752018Ab0ESCIb (ORCPT ); Tue, 18 May 2010 22:08:31 -0400 From: Arnaldo Carvalho de Melo To: Ingo Molnar Cc: linux-kernel@vger.kernel.org, Arnaldo Carvalho de Melo , =?utf-8?q?Fr=C3=A9d=C3=A9ric=20Weisbecker?= , Masami Hiramatsu , Mike Galbraith , Paul Mackerras , Peter Zijlstra , Tom Zanussi Subject: [PATCH v2 4/5] perf probe: Don't call die() Date: Tue, 18 May 2010 23:08:19 -0300 Message-Id: <1274234900-12162-5-git-send-email-acme@infradead.org> X-Mailer: git-send-email 1.6.2.5 In-Reply-To: <1274234900-12162-1-git-send-email-acme@infradead.org> References: <1274234900-12162-1-git-send-email-acme@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnaldo Carvalho de Melo Functions that were calling xzalloc also returned -1 when, for other reasons, it could fail, and the calleds are coping with failures, so stop using die() and xzalloc(). Cc: Frédéric Weisbecker Cc: Masami Hiramatsu Cc: Mike Galbraith Cc: Paul Mackerras Cc: Peter Zijlstra Cc: Tom Zanussi LKML-Reference: Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-probe.c | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c index 61c6d70..e4a4da3 100644 --- a/tools/perf/builtin-probe.c +++ b/tools/perf/builtin-probe.c @@ -65,8 +65,10 @@ static int parse_probe_event(const char *str) int ret; pr_debug("probe-definition(%d): %s\n", params.nevents, str); - if (++params.nevents == MAX_PROBES) - die("Too many probes (> %d) are specified.", MAX_PROBES); + if (++params.nevents == MAX_PROBES) { + pr_err("Too many probes (> %d) were specified.", MAX_PROBES); + return -1; + } /* Parse a perf-probe command into event */ ret = parse_perf_probe_command(str, pev); @@ -84,7 +86,9 @@ static int parse_probe_event_argv(int argc, const char **argv) len = 0; for (i = 0; i < argc; i++) len += strlen(argv[i]) + 1; - buf = xzalloc(len + 1); + buf = zalloc(len + 1); + if (buf == NULL) + return -ENOMEM; len = 0; for (i = 0; i < argc; i++) len += sprintf(&buf[len], "%s ", argv[i]); -- 1.6.2.5