From nobody Fri Sep 12 07:33:33 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 EFF58C001B0 for ; Thu, 10 Aug 2023 13:57:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235492AbjHJN5K (ORCPT ); Thu, 10 Aug 2023 09:57:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230446AbjHJN5J (ORCPT ); Thu, 10 Aug 2023 09:57:09 -0400 Received: from wxsgout04.xfusion.com (wxsgout04.xfusion.com [36.139.87.180]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99E74212B for ; Thu, 10 Aug 2023 06:57:04 -0700 (PDT) Received: from wuxshcsitd00600.xfusion.com (unknown [10.32.133.213]) by wxsgout04.xfusion.com (SkyGuard) with ESMTPS id 4RM7jW43R3z9y0cV; Thu, 10 Aug 2023 21:55:27 +0800 (CST) Received: from fedora (10.82.147.3) by wuxshcsitd00600.xfusion.com (10.32.133.213) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Thu, 10 Aug 2023 21:56:40 +0800 Date: Thu, 10 Aug 2023 21:56:39 +0800 From: Wang Jinchao To: Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Daniel Vetter , , , CC: Subject: [PATCH] drm/i915/gmch: fix build error var set but not used Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.82.147.3] X-ClientProxiedBy: wuxshcsitd00602.xfusion.com (10.32.132.250) To wuxshcsitd00600.xfusion.com (10.32.133.213) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When CONFIG_PNP is not defined, i915 will fail to compile with error bellow: drivers/gpu/drm/i915/soc/intel_gmch.c:43:13: error: variable =E2=80=98mchb= ar_addr=E2=80=99 set but not used Fix it by surrounding variable declaration and assignment with ifdef Signed-off-by: Wang Jinchao --- drivers/gpu/drm/i915/soc/intel_gmch.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/soc/intel_gmch.c b/drivers/gpu/drm/i915/s= oc/intel_gmch.c index 6d0204942f7a..d2c442b0b4eb 100644 --- a/drivers/gpu/drm/i915/soc/intel_gmch.c +++ b/drivers/gpu/drm/i915/soc/intel_gmch.c @@ -38,16 +38,17 @@ intel_alloc_mchbar_resource(struct drm_i915_private *i9= 15) { int reg =3D GRAPHICS_VER(i915) >=3D 4 ? MCHBAR_I965 : MCHBAR_I915; u32 temp_lo, temp_hi =3D 0; - u64 mchbar_addr; int ret; - +#ifdef CONFIG_PNP + u64 mchbar_addr; +#endif if (GRAPHICS_VER(i915) >=3D 4) pci_read_config_dword(i915->gmch.pdev, reg + 4, &temp_hi); pci_read_config_dword(i915->gmch.pdev, reg, &temp_lo); - mchbar_addr =3D ((u64)temp_hi << 32) | temp_lo; =20 /* If ACPI doesn't have it, assume we need to allocate it ourselves */ #ifdef CONFIG_PNP + mchbar_addr =3D ((u64)temp_hi << 32) | temp_lo; if (mchbar_addr && pnp_range_reserved(mchbar_addr, mchbar_addr + MCHBAR_SIZE)) return 0; --=20 2.40.0