]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
MIPS/Perf-events: Cleanup event->destroy at event init
authorDeng-Cheng Zhu <dczhu@mips.com>
Mon, 21 Nov 2011 19:28:48 +0000 (03:28 +0800)
committerRalf Baechle <ralf@linux-mips.org>
Tue, 22 Nov 2011 13:45:20 +0000 (13:45 +0000)
Simplify the code by changing the place of event->destroy().

Signed-off-by: Deng-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: Ralf Baechle <ralf@linux-mips.org>
arch/mips/kernel/perf_event_mipsxx.c

index b22cc5fd596deb8fec08ea3e8ee7125f8e1b8d44..bda4bc9e6988bcab40f6b5513748c861d7a0adec 100644 (file)
@@ -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;
 }