mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] perf script: Fix error handling path
@ 2017-09-16  6:25 Christophe JAILLET
  2017-10-24 10:16 ` [tip:perf/core] " tip-bot for Christophe JAILLET
  0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2017-09-16  6:25 UTC (permalink / raw)
  To: peterz, mingo, acme, alexander.shishkin
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET

If the string passed in '--time' is invalid, or if failed to set
libtraceevent function resolver, we must do some cleanup before leaving.
As in the other error handling paths of this function.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 tools/perf/builtin-script.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index 378f76cdf923..78ffdb4cbdea 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -3004,7 +3004,8 @@ int cmd_script(int argc, const char **argv)
 					 machine__resolve_kernel_addr,
 					 &session->machines.host) < 0) {
 		pr_err("%s: failed to set libtraceevent function resolver\n", __func__);
-		return -1;
+		err = -1;
+		goto out_delete;
 	}
 
 	if (generate_script_lang) {
@@ -3064,7 +3065,8 @@ int cmd_script(int argc, const char **argv)
 	/* needs to be parsed after looking up reference time */
 	if (perf_time__parse_str(&script.ptime, script.time_str) != 0) {
 		pr_err("Invalid time string\n");
-		return -EINVAL;
+		err = -EINVAL;
+		goto out_delete;
 	}
 
 	err = __cmd_script(&script);
-- 
2.11.0

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [tip:perf/core] perf script: Fix error handling path
  2017-09-16  6:25 [PATCH] perf script: Fix error handling path Christophe JAILLET
@ 2017-10-24 10:16 ` tip-bot for Christophe JAILLET
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for Christophe JAILLET @ 2017-10-24 10:16 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: hpa, mingo, peterz, acme, alexander.shishkin, christophe.jaillet,
	tglx, linux-kernel

Commit-ID:  db49bc155ad9f04ea3c4e1c9ae87850610feb1ce
Gitweb:     https://git.kernel.org/tip/db49bc155ad9f04ea3c4e1c9ae87850610feb1ce
Author:     Christophe JAILLET <christophe.jaillet@wanadoo.fr>
AuthorDate: Sat, 16 Sep 2017 08:25:37 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 23 Oct 2017 16:30:53 -0300

perf script: Fix error handling path

If the string passed in '--time' is invalid, or if failed to set
libtraceevent function resolver, we must do some cleanup before leaving.
As in the other error handling paths of this function.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: kernel-janitors@vger.kernel.org
Link: http://lkml.kernel.org/r/20170916062537.28921-1-christophe.jaillet@wanadoo.fr
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-script.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index 3e83f47..a3add2c 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -3074,7 +3074,8 @@ int cmd_script(int argc, const char **argv)
 					 machine__resolve_kernel_addr,
 					 &session->machines.host) < 0) {
 		pr_err("%s: failed to set libtraceevent function resolver\n", __func__);
-		return -1;
+		err = -1;
+		goto out_delete;
 	}
 
 	if (generate_script_lang) {
@@ -3134,7 +3135,8 @@ int cmd_script(int argc, const char **argv)
 	/* needs to be parsed after looking up reference time */
 	if (perf_time__parse_str(&script.ptime, script.time_str) != 0) {
 		pr_err("Invalid time string\n");
-		return -EINVAL;
+		err = -EINVAL;
+		goto out_delete;
 	}
 
 	err = __cmd_script(&script);

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-10-24 10:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-16  6:25 [PATCH] perf script: Fix error handling path Christophe JAILLET
2017-10-24 10:16 ` [tip:perf/core] " tip-bot for Christophe JAILLET

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome