From: Deng-Cheng Zhu Date: Mon, 21 Nov 2011 19:28:48 +0000 (+0800) Subject: MIPS/Perf-events: Cleanup event->destroy at event init X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=ff5d7265cfb88e8f8943a55afde90255fc5deacb;p=linux-beck.git MIPS/Perf-events: Cleanup event->destroy at event init Simplify the code by changing the place of event->destroy(). Signed-off-by: Deng-Cheng Zhu Cc: Peter Zijlstra Cc: Paul Mackerras Cc: Ingo Molnar Cc: Arnaldo Carvalho de Melo Cc: David Daney Cc: Eyal Barzilay Cc: Zenon Fortuna Patchwork: https://patchwork.linux-mips.org/patch/3109/ Signed-off-by: Ralf Baechle --- diff --git a/arch/mips/kernel/perf_event_mipsxx.c b/arch/mips/kernel/perf_event_mipsxx.c index b22cc5fd596d..bda4bc9e6988 100644 --- a/arch/mips/kernel/perf_event_mipsxx.c +++ b/arch/mips/kernel/perf_event_mipsxx.c @@ -633,11 +633,7 @@ static int mipspmu_event_init(struct perf_event *event) if (err) return err; - err = __hw_perf_event_init(event); - if (err) - hw_perf_event_destroy(event); - - return err; + return __hw_perf_event_init(event); } static struct pmu pmu = { @@ -1262,13 +1258,14 @@ static int __hw_perf_event_init(struct perf_event *event) } err = 0; - if (event->group_leader != event) { + if (event->group_leader != event) err = validate_group(event); - if (err) - return -EINVAL; - } event->destroy = hw_perf_event_destroy; + + if (err) + event->destroy(event); + return err; }