From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753470AbdDJMVm (ORCPT ); Mon, 10 Apr 2017 08:21:42 -0400 Received: from mail.skyhub.de ([5.9.137.197]:60066 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753263AbdDJMVG (ORCPT ); Mon, 10 Apr 2017 08:21:06 -0400 From: Borislav Petkov To: X86 ML Cc: Peter Zijlstra , Suravee Suthikulpanit , LKML Subject: [PATCH 1/3] events/amd/uncore: Do feature check first, before assignments Date: Mon, 10 Apr 2017 14:20:45 +0200 Message-Id: <20170410122047.3026-2-bp@alien8.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170410122047.3026-1-bp@alien8.de> References: <20170410122047.3026-1-bp@alien8.de> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Borislav Petkov ... and save some unnecessary work. Remove now unused label while at it. Signed-off-by: Borislav Petkov --- 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