From nobody Wed Dec 17 05:26:53 2025 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 C0B0FC4167B for ; Wed, 29 Nov 2023 15:33:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343554AbjK2Pcw (ORCPT ); Wed, 29 Nov 2023 10:32:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234907AbjK2Pct (ORCPT ); Wed, 29 Nov 2023 10:32:49 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C534D43 for ; Wed, 29 Nov 2023 07:32:56 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AD688C433C8; Wed, 29 Nov 2023 15:32:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701271975; bh=IMG9YxIDr+Fl0aVREHwJe3Kp/N91o8sNpnhBkBL/3ec=; h=From:To:Cc:Subject:Date:From; b=jombYPbint8xcSYE63U6Vb+r6J/OhHwSHDwRI4LUYDP6Zo3RBxoekRSiAD2Vr9pPL snrYkeva4AjB/vBkxVGudlG12nPSCb4QX8uUa4Mv6ALz/svtS2Gt487tt0PSwOZB2F g8WmEh24o2EjEzx0/uaJkYK9r/XXOfRz9jNTNmbcfN/s5R5v8UyUu+j3oNIXj0eBF5 yI4VSAZ099/hS5Y3rHH/DIZgDTyIUB+QcO6XW6sTEMTr+/voOzaFgPHqc6Qyw/hJL+ /vWi5E5hFlvKgpAPQO/07ou8SaoTDJ860pl+ANdneOZP7i78EHjggJ/vps5dJra2xG 2k8koekovXphA== From: Arnd Bergmann To: Paolo Bonzini , Yu Zhang , Isaku Yamahata , Chao Peng , "Kirill A. Shutemov" Cc: Arnd Bergmann , Sean Christopherson , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] KVM: guest-memfd: fix unused-function warning Date: Wed, 29 Nov 2023 16:32:40 +0100 Message-Id: <20231129153250.3105359-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Arnd Bergmann With migration disabled, one function becomes unused: virt/kvm/guest_memfd.c:262:12: error: 'kvm_gmem_migrate_folio' defined but = not used [-Werror=3Dunused-function] 262 | static int kvm_gmem_migrate_folio(struct address_space *mapping, | ^~~~~~~~~~~~~~~~~~~~~~ Replace the #ifdef around the reference with a corresponding PTR_IF() check that lets the compiler know how it is otherwise used. Fixes: a7800aa80ea4 ("KVM: Add KVM_CREATE_GUEST_MEMFD ioctl() for guest-spe= cific backing memory") Signed-off-by: Arnd Bergmann --- virt/kvm/guest_memfd.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/virt/kvm/guest_memfd.c b/virt/kvm/guest_memfd.c index 16d58806e913..1a0355b95379 100644 --- a/virt/kvm/guest_memfd.c +++ b/virt/kvm/guest_memfd.c @@ -301,9 +301,8 @@ static int kvm_gmem_error_folio(struct address_space *m= apping, =20 static const struct address_space_operations kvm_gmem_aops =3D { .dirty_folio =3D noop_dirty_folio, -#ifdef CONFIG_MIGRATION - .migrate_folio =3D kvm_gmem_migrate_folio, -#endif + .migrate_folio =3D PTR_IF(IS_ENABLED(CONFIG_MIGRATION), + kvm_gmem_migrate_folio), .error_remove_folio =3D kvm_gmem_error_folio, }; =20 --=20 2.39.2