Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1619874 > unrolled thread

[PATCH 1/3] events/amd/uncore: Do feature check first, before assignments

Started byBorislav Petkov <bp@alien8.de>
First post2017-04-10 14:30 +0200
Last post2017-04-11 10:10 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 1/3] events/amd/uncore: Do feature check first, before assignments Borislav Petkov <bp@alien8.de> - 2017-04-10 14:30 +0200
    [tip:perf/core] perf/amd/uncore: Do feature check first, before  assignments tip-bot for Borislav Petkov <tipbot@zytor.com> - 2017-04-11 10:10 +0200

#1619874 — [PATCH 1/3] events/amd/uncore: Do feature check first, before assignments

FromBorislav Petkov <bp@alien8.de>
Date2017-04-10 14:30 +0200
Subject[PATCH 1/3] events/amd/uncore: Do feature check first, before assignments
Message-ID<tuGCd-Cp-7@gated-at.bofh.it>
From: Borislav Petkov <bp@suse.de>

... and save some unnecessary work. Remove now unused label while at it.

Signed-off-by: Borislav Petkov <bp@suse.de>
---
 arch/x86/events/amd/uncore.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/arch/x86/events/amd/uncore.c b/arch/x86/events/amd/uncore.c
index 4d1f7f2d9aff..abd4b9064fba 100644
--- a/arch/x86/events/amd/uncore.c
+++ b/arch/x86/events/amd/uncore.c
@@ -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 @@ static int __init amd_uncore_init(void)
 	if (amd_uncore_nb)
 		free_percpu(amd_uncore_nb);
 
-fail_nodev:
 	return ret;
 }
 device_initcall(amd_uncore_init);
-- 
2.11.0

[toc] | [next] | [standalone]


#1621008 — [tip:perf/core] perf/amd/uncore: Do feature check first, before assignments

Fromtip-bot for Borislav Petkov <tipbot@zytor.com>
Date2017-04-11 10:10 +0200
Subject[tip:perf/core] perf/amd/uncore: Do feature check first, before assignments
Message-ID<tuZ2b-4oA-31@gated-at.bofh.it>
In reply to#1619874
Commit-ID:  c2628f90c9964881a62dd8e9f7372ca05cb6fe32
Gitweb:     http://git.kernel.org/tip/c2628f90c9964881a62dd8e9f7372ca05cb6fe32
Author:     Borislav Petkov <bp@suse.de>
AuthorDate: Mon, 10 Apr 2017 14:20:45 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 11 Apr 2017 08:44:59 +0200

perf/amd/uncore: Do feature check first, before assignments

... 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 | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/arch/x86/events/amd/uncore.c b/arch/x86/events/amd/uncore.c
index 4d1f7f2d..abd4b90 100644
--- a/arch/x86/events/amd/uncore.c
+++ b/arch/x86/events/amd/uncore.c
@@ -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);

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web