Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp260715ybl; Thu, 23 Jan 2020 23:12:59 -0800 (PST) X-Google-Smtp-Source: APXvYqyns4DV++qzVWP3Z42MKzVFrrSMYileexZZhVYNH/X4NjPJki4QtfUAFKjOxh0ThMx5uoDz X-Received: by 2002:a9d:461b:: with SMTP id y27mr1930719ote.280.1579849979600; Thu, 23 Jan 2020 23:12:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579849979; cv=none; d=google.com; s=arc-20160816; b=j8bMaI/Cp0bjjXNT+vS8NhBIcQWG+fyrNfvfx4jdnKDqHDuyv2FtkwDgr3bc54hIuY zA0v+KmufdHKKRYzZaj2Hkq4BNPXfbluzBRCwTrmFa6TtwD8BYY5MLDJYyN1JCZQmX7+ jhI0Iuuilcm42UXa1Ynfrop8CbBClJjg0IoCiTl/Jbf/JcOJqK0a0nyAp9ymxG8vXE7J VqwwhglP7XT+Sa+iC2S5HYNraVxAFNNk1fd2JNfhf/iFCxUNvqg+cuhvuUc0WJzssj/y bzDEu703vRKrCGJ9OBEovhBGbYyg47Ll+UsdjOOL3LJi9mS8KzHREk7J11JLVY9+t3eU HUjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:cc:to:subject:from:references :in-reply-to:message-id:dkim-signature; bh=fhFiAnvvWyjTIiMqAPcGOlHB6PXfVt634Yxsn29/V2g=; b=b4nQXMrBGmdiJBotg9SmHxk/IjQwuOWIDrI0qQJthPH1hwnuyaeTRjcngNP9N6UIk/ nYZXtrc2k9z2MUGM5yIbU4KBIwCoOr4KsJgP4gWv9+5iYUWLtUaxw9mEd38OhLHPbPmq Q1ULbbL0D9ezlHH0CURXQfV5ggQNKlatCOP6BhlhfSGSPTOkI1VqzT3QWixsnkmuaNE+ t+dejcxvn6KCRmCcsR6OXlRkdKFmMO7C9Pgn29B3cFBFH7rrqqsCbT/2Cp1bo+A3FjV4 gBakez69NsW8nacCpOjnvgddrDGobxQeT1Gf/bXJb7MHMqWJ855tRBUn9dCzu7eIbRAx DESw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=LVGZPs8j; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h3si2388413otq.203.2020.01.23.23.12.47; Thu, 23 Jan 2020 23:12:59 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=LVGZPs8j; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727163AbgAXHHz (ORCPT + 99 others); Fri, 24 Jan 2020 02:07:55 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:56722 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725843AbgAXHHy (ORCPT ); Fri, 24 Jan 2020 02:07:54 -0500 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 483qwS5RPgz9tyWV; Fri, 24 Jan 2020 08:07:52 +0100 (CET) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=LVGZPs8j; dkim-adsp=pass; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id phykYOSKMkXm; Fri, 24 Jan 2020 08:07:52 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 483qwS4DKyz9tyWM; Fri, 24 Jan 2020 08:07:52 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1579849672; bh=fhFiAnvvWyjTIiMqAPcGOlHB6PXfVt634Yxsn29/V2g=; h=In-Reply-To:References:From:Subject:To:Cc:Date:From; b=LVGZPs8joBTmAZSxtukaFS53pwlP+h4eFQLAeZ98CTdmZqaoaB1oUdFb0J95vOjhC sCXr+nVxrAy+3jx4ORi362UiixeHQ/tIOQ/TcWMQ4WLn3ZB/2ZezWwNy3XIOlgH+rD JvyZf7TzJK6+W4vVz2Xwsuq8GmmKJYZZZgYatqb4= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 7DD6F8B83D; Fri, 24 Jan 2020 08:07:53 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id aFWddb0YxbC0; Fri, 24 Jan 2020 08:07:53 +0100 (CET) Received: from po14934vm.idsi0.si.c-s.fr (po15451.idsi0.si.c-s.fr [172.25.230.111]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 604C98B768; Fri, 24 Jan 2020 08:07:53 +0100 (CET) Received: by po14934vm.idsi0.si.c-s.fr (Postfix, from userid 0) id 5F2716379C; Fri, 24 Jan 2020 07:07:53 +0000 (UTC) Message-Id: <98855694e9e8993673af08cc2e97e16e0cf50f4a.1579849665.git.christophe.leroy@c-s.fr> In-Reply-To: <435e0030e942507766cbef5bc95f906262d2ccf2.1579849665.git.christophe.leroy@c-s.fr> References: <435e0030e942507766cbef5bc95f906262d2ccf2.1579849665.git.christophe.leroy@c-s.fr> From: Christophe Leroy Subject: [PATCH v2 2/3] powerpc/irq: use IS_ENABLED() in check_stack_overflow() To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Fri, 24 Jan 2020 07:07:53 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Instead of #ifdef, use IS_ENABLED(CONFIG_DEBUG_STACKOVERFLOW). This enable GCC to check for code validity even when the option is not selected. --- v2: rebased Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/irq.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c index cd29c2eb2d8e..9333e115418f 100644 --- a/arch/powerpc/kernel/irq.c +++ b/arch/powerpc/kernel/irq.c @@ -598,9 +598,11 @@ u64 arch_irq_stat_cpu(unsigned int cpu) static inline void check_stack_overflow(void) { -#ifdef CONFIG_DEBUG_STACKOVERFLOW long sp; + if (!IS_ENABLED(CONFIG_DEBUG_STACKOVERFLOW)) + return; + sp = get_sp() & (THREAD_SIZE - 1); /* check for stack overflow: is there less than 2KB free? */ @@ -608,7 +610,6 @@ static inline void check_stack_overflow(void) pr_err("do_IRQ: stack overflow: %ld\n", sp); dump_stack(); } -#endif } void __do_irq(struct pt_regs *regs) -- 2.25.0