linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	David Ahern <dsahern@gmail.com>, Jiri Olsa <jolsa@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Wang Nan <wangnan0@huawei.com>
Subject: [PATCH 14/15] perf scripting: Don't die if scripting can't be setup, disable it
Date: Thu, 27 Oct 2016 18:40:54 -0200	[thread overview]
Message-ID: <1477600855-27580-15-git-send-email-acme@kernel.org> (raw)
In-Reply-To: <1477600855-27580-1-git-send-email-acme@kernel.org>

From: Arnaldo Carvalho de Melo <acme@redhat.com>

Removing one more set of die() calls.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-6pyil685m5i2tugg56gcy0tg@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/trace-event-scripting.c | 33 +++++++++++++++------------------
 1 file changed, 15 insertions(+), 18 deletions(-)

diff --git a/tools/perf/util/trace-event-scripting.c b/tools/perf/util/trace-event-scripting.c
index a2fd6e79d5a5..0ac9077f62a2 100644
--- a/tools/perf/util/trace-event-scripting.c
+++ b/tools/perf/util/trace-event-scripting.c
@@ -25,6 +25,7 @@
 #include <errno.h>
 
 #include "../perf.h"
+#include "debug.h"
 #include "util.h"
 #include "trace-event.h"
 
@@ -86,17 +87,15 @@ struct scripting_ops python_scripting_unsupported_ops = {
 
 static void register_python_scripting(struct scripting_ops *scripting_ops)
 {
-	int err;
-	err = script_spec_register("Python", scripting_ops);
-	if (err)
-		die("error registering Python script extension");
-
-	err = script_spec_register("py", scripting_ops);
-	if (err)
-		die("error registering py script extension");
-
 	if (scripting_context == NULL)
 		scripting_context = malloc(sizeof(*scripting_context));
+
+       if (scripting_context == NULL ||
+	   script_spec_register("Python", scripting_ops) ||
+	   script_spec_register("py", scripting_ops)) {
+		pr_err("Error registering Python script extension: disabling it\n");
+		zfree(&scripting_context);
+	}
 }
 
 #ifdef NO_LIBPYTHON
@@ -151,17 +150,15 @@ struct scripting_ops perl_scripting_unsupported_ops = {
 
 static void register_perl_scripting(struct scripting_ops *scripting_ops)
 {
-	int err;
-	err = script_spec_register("Perl", scripting_ops);
-	if (err)
-		die("error registering Perl script extension");
-
-	err = script_spec_register("pl", scripting_ops);
-	if (err)
-		die("error registering pl script extension");
-
 	if (scripting_context == NULL)
 		scripting_context = malloc(sizeof(*scripting_context));
+
+       if (scripting_context == NULL ||
+	   script_spec_register("Perl", scripting_ops) ||
+	   script_spec_register("pl", scripting_ops)) {
+		pr_err("Error registering Perl script extension: disabling it\n");
+		zfree(&scripting_context);
+	}
 }
 
 #ifdef NO_LIBPERL
-- 
2.7.4

  parent reply	other threads:[~2016-10-27 20:41 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-27 20:40 [GIT PULL 00/15] perf/core improvements and fixes Arnaldo Carvalho de Melo
2016-10-27 20:40 ` [PATCH 01/15] perf bench futex: Avoid worker cacheline bouncing Arnaldo Carvalho de Melo
2016-10-27 20:40 ` [PATCH 02/15] perf bench futex: Sanitize numeric parameters Arnaldo Carvalho de Melo
2016-10-27 20:40 ` [PATCH 03/15] perf hist browser: Fix hierarchy column counts Arnaldo Carvalho de Melo
2016-10-27 20:40 ` [PATCH 04/15] tools lib subcmd: Suppport cascading options Arnaldo Carvalho de Melo
2016-10-27 20:40 ` [PATCH 05/15] perf sched: Make common options cascading Arnaldo Carvalho de Melo
2016-10-27 20:40 ` [PATCH 06/15] perf sched map: Apply cpu color when there's an activity Arnaldo Carvalho de Melo
2016-10-27 20:40 ` [PATCH 07/15] perf sched map: Always show task comm with -v Arnaldo Carvalho de Melo
2016-10-27 20:40 ` [PATCH 08/15] perf tools: Introduce timestamp_in_usec() Arnaldo Carvalho de Melo
2016-10-27 23:14   ` Joonwoo Park
2016-10-28 12:53     ` Arnaldo Carvalho de Melo
2016-10-28 13:30       ` Arnaldo Carvalho de Melo
2016-10-28 14:42         ` [GIT PULL] " Arnaldo Carvalho de Melo
2016-10-28 17:39           ` Ingo Molnar
2016-10-28 17:46             ` Joonwoo Park
2016-10-27 20:40 ` [PATCH 09/15] perf list: Support matching by topic Arnaldo Carvalho de Melo
2016-10-27 20:40 ` [PATCH 10/15] perf bench mem: Ignore export.h related changes to mem{cpy,set}.S Arnaldo Carvalho de Melo
2016-10-27 20:40 ` [PATCH 11/15] tools: Update asm-generic/mman-common.h copy from the kernel Arnaldo Carvalho de Melo
2016-10-27 20:40 ` [PATCH 12/15] perf tools: Update x86's syscall_64.tbl, adding pkey_(alloc,free,mprotect) Arnaldo Carvalho de Melo
2016-10-27 20:40 ` [PATCH 13/15] perf scripting: Avoid leaking the scripting_context variable Arnaldo Carvalho de Melo
2016-10-27 20:40 ` Arnaldo Carvalho de Melo [this message]
2016-10-27 20:40 ` [PATCH 15/15] perf tools: Add missing object file to the python binding linkage list Arnaldo Carvalho de Melo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1477600855-27580-15-git-send-email-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=adrian.hunter@intel.com \
    --cc=dsahern@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=wangnan0@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).