Commit ff5d7265 authored by Deng-Cheng Zhu's avatar Deng-Cheng Zhu Committed by Ralf Baechle

MIPS/Perf-events: Cleanup event->destroy at event init

Simplify the code by changing the place of event->destroy().
Signed-off-by: default avatarDeng-Cheng Zhu <dczhu@mips.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: David Daney <david.daney@cavium.com>
Cc: Eyal Barzilay <eyal@mips.com>
Cc: Zenon Fortuna <zenon@mips.com>
Patchwork: https://patchwork.linux-mips.org/patch/3109/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent 266623b7
...@@ -633,11 +633,7 @@ static int mipspmu_event_init(struct perf_event *event) ...@@ -633,11 +633,7 @@ static int mipspmu_event_init(struct perf_event *event)
if (err) if (err)
return err; return err;
err = __hw_perf_event_init(event); return __hw_perf_event_init(event);
if (err)
hw_perf_event_destroy(event);
return err;
} }
static struct pmu pmu = { static struct pmu pmu = {
...@@ -1262,13 +1258,14 @@ static int __hw_perf_event_init(struct perf_event *event) ...@@ -1262,13 +1258,14 @@ static int __hw_perf_event_init(struct perf_event *event)
} }
err = 0; err = 0;
if (event->group_leader != event) { if (event->group_leader != event)
err = validate_group(event); err = validate_group(event);
if (err)
return -EINVAL;
}
event->destroy = hw_perf_event_destroy; event->destroy = hw_perf_event_destroy;
if (err)
event->destroy(event);
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment