Received: by 2002:a05:6a10:83d0:0:0:0:0 with SMTP id o16csp63043pxh; Thu, 7 Apr 2022 14:03:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwISbSSbMeA7lTn9fgX5ByqP9N9DvTlrqWi+V43JMWXszhaAuOWgaN3Td4s2gxs497o1S9C X-Received: by 2002:a65:530b:0:b0:382:b21d:82eb with SMTP id m11-20020a65530b000000b00382b21d82ebmr13042080pgq.215.1649365411566; Thu, 07 Apr 2022 14:03:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649365411; cv=none; d=google.com; s=arc-20160816; b=n2SShWuMXCGRkiTvaVox+Kf8mwg6Q4CX0Wm1P8QrgxpmOOkDK1XARkfr4dgGpgscpc sE/usN9n5rBKlv44l1nKD2NKwh49Bb0yXjiwZ/mGOX3lJ2O4qwFJhEefM4kikdfVw0xe 1PYWbtVgmeLEaczkfn5agfbHyDqnekdtz2+V8gRZGMNthVjv1UWz3xUZGJXO4hzTNT73 cjGdKXyjFounezKsw6kWXYPBW3PFgO66JONiQKiDVa98zWXJgZPxNJJUlAV4zqdYz6uv s0Xb1yvvmm1LulQVeTcvZF7c/lA4QbaUdhSocAwN6zSGfx3ovP6BWEW1Yt9e8TasWAdl aLZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=CD8nypHAzTWkETkxyXrq4e8Iid7iboPaOsiGxNeEBS4=; b=YO1oN3GtdqLsN/5kMku2uvbiG8WxrMrmMMVDPK6DgNDb5a+WCZKunqTm8yRqJbJqgw D0ipJ2bK39SYX0DOfvy4anojwgj9yMCTQgy1EeIovvat6pGBz6paC7qOhGsSr3oSu6T6 jOGOxHULAjYNxMYFllb1j/bLx4V2oumogDfj4/rQzotZA3+35v49tqPCcnfLn5gyt1JL cFIsq+co2Peztks6yUNbcS7kE6TQrEJ2orN9SWp07LQnHkO7iblEdlKPRuu9c81sk+WY vT+8dUSdvK+FzQlSgwzv4daWljbId/LSVZvpqrrJJvg+w4d3g9mgdhBm4+gkxDK+eHeO K7Rw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id h9-20020a170902f70900b00153b2d164e0si749335plo.232.2022.04.07.14.03.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Apr 2022 14:03:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 30EB42B20CB; Thu, 7 Apr 2022 13:08:29 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242134AbiDGHsh (ORCPT + 99 others); Thu, 7 Apr 2022 03:48:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242360AbiDGHsW (ORCPT ); Thu, 7 Apr 2022 03:48:22 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50FE9C31F7 for ; Thu, 7 Apr 2022 00:46:22 -0700 (PDT) Received: from canpemm500007.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4KYtjD4l6dzdZjC; Thu, 7 Apr 2022 15:45:52 +0800 (CST) Received: from localhost (10.174.179.215) by canpemm500007.china.huawei.com (7.192.104.62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 7 Apr 2022 15:46:20 +0800 From: YueHaibing To: , , , CC: , YueHaibing Subject: [PATCH -next] ftrace: Fix build warning Date: Thu, 7 Apr 2022 15:46:12 +0800 Message-ID: <20220407074612.16608-1-yuehaibing@huawei.com> X-Mailer: git-send-email 2.10.2.windows.1 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.179.215] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To canpemm500007.china.huawei.com (7.192.104.62) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If CONFIG_SYSCTL and CONFIG_DYNAMIC_FTRACE is n, build warns: kernel/trace/ftrace.c:7912:13: error: ‘is_permanent_ops_registered’ defined but not used [-Werror=unused-function] static bool is_permanent_ops_registered(void) ^~~~~~~~~~~~~~~~~~~~~~~~~~~ kernel/trace/ftrace.c:89:12: error: ‘last_ftrace_enabled’ defined but not used [-Werror=unused-variable] static int last_ftrace_enabled; ^~~~~~~~~~~~~~~~~~~ Move is_permanent_ops_registered() to ifdef block and mark last_ftrace_enabled as __maybe_unused to fix this. Fixes: 7cde53da38a3 ("ftrace: move sysctl_ftrace_enabled to ftrace.c") Signed-off-by: YueHaibing --- kernel/trace/ftrace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index a5efbbc289b4..db8d553728b6 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -86,7 +86,7 @@ struct ftrace_ops ftrace_list_end __read_mostly = { /* ftrace_enabled is a method to turn ftrace on or off */ int ftrace_enabled __read_mostly; -static int last_ftrace_enabled; +static int __maybe_unused last_ftrace_enabled; /* Current function tracing op */ struct ftrace_ops *function_trace_op __read_mostly = &ftrace_list_end; @@ -7909,6 +7909,7 @@ int unregister_ftrace_function(struct ftrace_ops *ops) } EXPORT_SYMBOL_GPL(unregister_ftrace_function); +#ifdef CONFIG_SYSCTL static bool is_permanent_ops_registered(void) { struct ftrace_ops *op; @@ -7921,7 +7922,6 @@ static bool is_permanent_ops_registered(void) return false; } -#ifdef CONFIG_SYSCTL static int ftrace_enable_sysctl(struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) -- 2.17.1