linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wang Xiaoqiang <wangxq10@lzu.edu.cn>
To: Ingo Molnar <mingo@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	linux-kernel@vger.kernel.org
Subject: [PATCH] perf/core: Directly return the error pointer instead of use 'goto'
Date: Mon, 18 Jan 2016 21:29:35 +0800	[thread overview]
Message-ID: <20160118212935.69417deb@debian> (raw)

Hi, Ingo,

    This patch return the error pointer directly, not use 'goto'. Patch
is as follows.

thanks,
Wang Xiaoqiang

>From 33ed914e6d3f3d63698b5e178efd648ca7cd086d Mon Sep 17 00:00:00 2001
From: Wang Xiaoqiang <wangxq10@lzu.edu.cn>
Date: Mon, 18 Jan 2016 21:14:06 +0800
Subject: [PATCH] perf/core: Directly return the error pointer instead of use
 'goto'

Just return the error pointer instead of using "goto" to make
the program structure more clear.

Signed-off-by: Wang Xiaoqiang <wangxq10@lzu.edu.cn>
---
 kernel/events/core.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index bf82441..1d250b2 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -8550,10 +8550,8 @@ perf_event_create_kernel_counter(struct perf_event_attr *attr, int cpu,
 
 	event = perf_event_alloc(attr, cpu, task, NULL, NULL,
 				 overflow_handler, context, -1);
-	if (IS_ERR(event)) {
-		err = PTR_ERR(event);
-		goto err;
-	}
+	if (IS_ERR(event))
+		return event;
 
 	/* Mark owner so we could distinguish it from user events. */
 	event->owner = EVENT_OWNER_KERNEL;
@@ -8584,7 +8582,7 @@ perf_event_create_kernel_counter(struct perf_event_attr *attr, int cpu,
 
 err_free:
 	free_event(event);
-err:
+
 	return ERR_PTR(err);
 }
 EXPORT_SYMBOL_GPL(perf_event_create_kernel_counter);
-- 
2.1.4

                 reply	other threads:[~2016-01-18 14:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20160118212935.69417deb@debian \
    --to=wangxq10@lzu.edu.cn \
    --cc=acme@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    /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).