From nobody Wed Apr 15 00:02:43 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85D01C00144 for ; Fri, 29 Jul 2022 10:04:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235263AbiG2KEu (ORCPT ); Fri, 29 Jul 2022 06:04:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229520AbiG2KEs (ORCPT ); Fri, 29 Jul 2022 06:04:48 -0400 Received: from theia.8bytes.org (8bytes.org [IPv6:2a01:238:4383:600:38bc:a715:4b6d:a889]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0D967B794 for ; Fri, 29 Jul 2022 03:04:47 -0700 (PDT) Received: from lemmy.home.8bytes.org (p549adf92.dip0.t-ipconnect.de [84.154.223.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by theia.8bytes.org (Postfix) with ESMTPSA id 794A9DC; Fri, 29 Jul 2022 12:04:45 +0200 (CEST) From: Joerg Roedel To: Joerg Roedel Cc: Suravee Suthikulpanit , Will Deacon , Jerry Snitselaar , iommu@lists.linux.dev, linux-kernel@vger.kernel.org, Joerg Roedel Subject: [PATCH] iommu/amd: Fix compile warning in init code Date: Fri, 29 Jul 2022 12:04:32 +0200 Message-Id: <20220729100432.22474-1-joro@8bytes.org> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Joerg Roedel A recent commit introduced these compile warnings: CC drivers/iommu/amd/init.o drivers/iommu/amd/init.c:938:12: error: =E2=80=98iommu_init_ga_log=E2=80=99= defined but not used [-Werror=3Dunused-function] 938 | static int iommu_init_ga_log(struct amd_iommu *iommu) | ^~~~~~~~~~~~~~~~~ drivers/iommu/amd/init.c:902:12: error: =E2=80=98iommu_ga_log_enable=E2=80= =99 defined but not used [-Werror=3Dunused-function] 902 | static int iommu_ga_log_enable(struct amd_iommu *iommu) | ^~~~~~~~~~~~~~~~~~~ The warnings appear because both functions are defined when IRQ remapping is not enabled, but only used when IRQ remapping is enabled. Fix it by only defining the functions when IRQ remapping is enabled. Fixes: c5e1a1eb9279 ("iommu/amd: Simplify and Consolidate Virtual APIC (AVI= C) Enablement") Signed-off-by: Joerg Roedel Reported-by: kernel test robot Reviewed-by: Jerry Snitselaar Reviewed-by: Suravee Suthikulpanit --- drivers/iommu/amd/init.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c index 6bbaf6b971e8..fdc642362c14 100644 --- a/drivers/iommu/amd/init.c +++ b/drivers/iommu/amd/init.c @@ -899,9 +899,9 @@ static void free_ga_log(struct amd_iommu *iommu) #endif } =20 +#ifdef CONFIG_IRQ_REMAP static int iommu_ga_log_enable(struct amd_iommu *iommu) { -#ifdef CONFIG_IRQ_REMAP u32 status, i; u64 entry; =20 @@ -931,13 +931,12 @@ static int iommu_ga_log_enable(struct amd_iommu *iomm= u) =20 if (WARN_ON(i >=3D LOOP_TIMEOUT)) return -EINVAL; -#endif /* CONFIG_IRQ_REMAP */ + return 0; } =20 static int iommu_init_ga_log(struct amd_iommu *iommu) { -#ifdef CONFIG_IRQ_REMAP if (!AMD_IOMMU_GUEST_IR_VAPIC(amd_iommu_guest_ir)) return 0; =20 @@ -955,10 +954,8 @@ static int iommu_init_ga_log(struct amd_iommu *iommu) err_out: free_ga_log(iommu); return -EINVAL; -#else - return 0; -#endif /* CONFIG_IRQ_REMAP */ } +#endif /* CONFIG_IRQ_REMAP */ =20 static int __init alloc_cwwb_sem(struct amd_iommu *iommu) { --=20 2.36.1