From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964958AbcHDPHK (ORCPT ); Thu, 4 Aug 2016 11:07:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37020 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752939AbcHDPHI (ORCPT ); Thu, 4 Aug 2016 11:07:08 -0400 From: Luiz Capitulino To: linux-kernel@vger.kernel.org Cc: bigeasy@linutronix.de, tglx@linutronix.de, anna-maria@linutronix.de Subject: [PATCH 2/2] x86/x2apic: check return value on probe Date: Thu, 4 Aug 2016 10:56:00 -0400 Message-Id: <1470322560-18333-3-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1470322560-18333-1-git-send-email-lcapitulino@redhat.com> References: <1470322560-18333-1-git-send-email-lcapitulino@redhat.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 04 Aug 2016 14:56:11 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org cpuhp_setup_state() can fail. If it does, we have to return 0 to upper layers. Signed-off-by: Luiz Capitulino --- arch/x86/kernel/apic/x2apic_cluster.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/apic/x2apic_cluster.c b/arch/x86/kernel/apic/x2apic_cluster.c index 18b1704..eb4e459 100644 --- a/arch/x86/kernel/apic/x2apic_cluster.c +++ b/arch/x86/kernel/apic/x2apic_cluster.c @@ -187,12 +187,14 @@ int x2apic_dead_cpu(unsigned int this_cpu) static int x2apic_cluster_probe(void) { + int ret; + if (!x2apic_mode) return 0; - cpuhp_setup_state(CPUHP_X2APIC_PREPARE, "X2APIC_PREPARE", + ret = cpuhp_setup_state(CPUHP_X2APIC_PREPARE, "X2APIC_PREPARE", x2apic_prepare_cpu, x2apic_dead_cpu); - return 1; + return ret < 0 ? 0 : 1; } static const struct cpumask *x2apic_cluster_target_cpus(void) -- 2.5.5