From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S942315AbcJ1RuC (ORCPT ); Fri, 28 Oct 2016 13:50:02 -0400 Received: from terminus.zytor.com ([198.137.202.10]:33148 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966244AbcJ1Rt6 (ORCPT ); Fri, 28 Oct 2016 13:49:58 -0400 Date: Fri, 28 Oct 2016 10:49:47 -0700 From: tip-bot for Arnaldo Carvalho de Melo Message-ID: Cc: mingo@kernel.org, wangnan0@huawei.com, adrian.hunter@intel.com, namhyung@kernel.org, linux-kernel@vger.kernel.org, tglx@linutronix.de, dsahern@gmail.com, jolsa@kernel.org, hpa@zytor.com, acme@redhat.com Reply-To: acme@redhat.com, hpa@zytor.com, jolsa@kernel.org, linux-kernel@vger.kernel.org, namhyung@kernel.org, adrian.hunter@intel.com, wangnan0@huawei.com, mingo@kernel.org, dsahern@gmail.com, tglx@linutronix.de To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf scripting: Don't die if scripting can't be setup, disable it Git-Commit-ID: 9a8860bbaa936407aa95d7d3ef836036a117b207 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 9a8860bbaa936407aa95d7d3ef836036a117b207 Gitweb: http://git.kernel.org/tip/9a8860bbaa936407aa95d7d3ef836036a117b207 Author: Arnaldo Carvalho de Melo AuthorDate: Tue, 25 Oct 2016 17:30:05 -0300 Committer: Arnaldo Carvalho de Melo CommitDate: Fri, 28 Oct 2016 11:29:44 -0200 perf scripting: Don't die if scripting can't be setup, disable it Removing one more set of die() calls. Cc: Adrian Hunter Cc: David Ahern Cc: Jiri Olsa Cc: Namhyung Kim Cc: Wang Nan Link: http://lkml.kernel.org/n/tip-6pyil685m5i2tugg56gcy0tg@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- 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 a2fd6e7..0ac9077 100644 --- a/tools/perf/util/trace-event-scripting.c +++ b/tools/perf/util/trace-event-scripting.c @@ -25,6 +25,7 @@ #include #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