[PATCH] perf/core: Directly return the error pointer instead of use 'goto'

From: Wang Xiaoqiang
Date: Mon Jan 18 2016 - 08:14:06 EST


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

Signed-off-by: Wang Xiaoqiang <wangxq10@xxxxxxxxxx>
---
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