perf/amd/uncore: Do feature check first, before assignments
authorBorislav Petkov <bp@suse.de>
Mon, 10 Apr 2017 12:20:45 +0000 (14:20 +0200)
committerIngo Molnar <mingo@kernel.org>
Tue, 11 Apr 2017 06:44:59 +0000 (08:44 +0200)
... and save some unnecessary work. Remove now unused label while at it.

Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vince Weaver <vincent.weaver@maine.edu>
Link: http://lkml.kernel.org/r/20170410122047.3026-2-bp@alien8.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/events/amd/uncore.c

index 4d1f7f2..abd4b90 100644 (file)
@@ -509,7 +509,10 @@ static int __init amd_uncore_init(void)
        int ret = -ENODEV;
 
        if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD)
-               goto fail_nodev;
+               return -ENODEV;
+
+       if (!boot_cpu_has(X86_FEATURE_TOPOEXT))
+               return -ENODEV;
 
        switch(boot_cpu_data.x86) {
                case 23:
@@ -552,9 +555,6 @@ static int __init amd_uncore_init(void)
        amd_nb_pmu.attr_groups = amd_uncore_attr_groups_df;
        amd_llc_pmu.attr_groups = amd_uncore_attr_groups_l3;
 
-       if (!boot_cpu_has(X86_FEATURE_TOPOEXT))
-               goto fail_nodev;
-
        if (boot_cpu_has(X86_FEATURE_PERFCTR_NB)) {
                amd_uncore_nb = alloc_percpu(struct amd_uncore *);
                if (!amd_uncore_nb) {
@@ -615,7 +615,6 @@ fail_nb:
        if (amd_uncore_nb)
                free_percpu(amd_uncore_nb);
 
-fail_nodev:
        return ret;
 }
 device_initcall(amd_uncore_init);