mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: tip-bot for Borislav Petkov <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: tglx@linutronix.de, torvalds@linux-foundation.org,
	jolsa@redhat.com, eranian@google.com, hpa@zytor.com,
	linux-kernel@vger.kernel.org, acme@redhat.com,
	vincent.weaver@maine.edu, Suravee.Suthikulpanit@amd.com,
	peterz@infradead.org, alexander.shishkin@linux.intel.com,
	bp@suse.de, mingo@kernel.org
Subject: [tip:perf/core] perf/amd/uncore: Do feature check first, before assignments
Date: Tue, 11 Apr 2017 00:57:06 -0700	[thread overview]
Message-ID: <tip-c2628f90c9964881a62dd8e9f7372ca05cb6fe32@git.kernel.org> (raw)
In-Reply-To: <20170410122047.3026-2-bp@alien8.de>

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);

  reply	other threads:[~2017-04-11  8:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-10 12:20 [PATCH 0/3] events/amd/uncore: Minor cleanups Borislav Petkov
2017-04-10 12:20 ` [PATCH 1/3] events/amd/uncore: Do feature check first, before assignments Borislav Petkov
2017-04-11  7:57   ` tip-bot for Borislav Petkov [this message]
2017-04-10 12:20 ` [PATCH 2/3] events/amd/uncore: Cleanup per-family setup Borislav Petkov
2017-04-11  7:57   ` [tip:perf/core] perf/amd/uncore: Clean up " tip-bot for Borislav Petkov
2017-04-10 12:20 ` [PATCH 3/3] events/amd/uncore: Fix pr_fmt prefix Borislav Petkov
2017-04-11  7:58   ` [tip:perf/core] perf/amd/uncore: Fix pr_fmt() prefix tip-bot for Borislav Petkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-c2628f90c9964881a62dd8e9f7372ca05cb6fe32@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=Suravee.Suthikulpanit@amd.com \
    --cc=acme@redhat.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=bp@suse.de \
    --cc=eranian@google.com \
    --cc=hpa@zytor.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=vincent.weaver@maine.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®