Message ID | 20230622101848.3482277-1-arnd@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp4967548vqr; Thu, 22 Jun 2023 03:39:25 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4nJ79MOHQXaHvIBgeeU8nTjGDeHJgk1C0h7YapoSw2GcWH3NeqdOk4IJ1ih8pwCJelrmyB X-Received: by 2002:a17:903:2443:b0:1b5:5ee1:1211 with SMTP id l3-20020a170903244300b001b55ee11211mr18952609pls.9.1687430364917; Thu, 22 Jun 2023 03:39:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687430364; cv=none; d=google.com; s=arc-20160816; b=jSUR4qYHkTHNpKZN78EOUHueqFNpFc6OYjnAzEEFomEyGxD0rVtnzwUTRJVYcea1Xa eBAO54CPeYdE6fTY5uuxGiU31biKE5KJr53pmFOO4JetHAxG2oA1AALXz4YRq51gjuuG aj2ITgQ8moUmQXkxjstnuBD7bUin0kBSNAruoEBjtMM6T6Z1PCXjGe6JBYuZaZB2U5Uh id4NQgqeyulxJkuVqD4qioK/gs0S6ZWNYBU85iqvbghqRCJQC3DfAhfYVjvHtIjW7ui+ uKP85eWcDb6deQXiaVzoc+1fuuuv2gCS1Be0jTgV7TYPzTedzkBVP3psPDAJ633SrJmC xa6Q== 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:dkim-signature; bh=65t6YOEy5QJjkb2LD5HkJND4tmTPvCAiguztUmMrGRI=; b=T5j1Wd24lhBe5SQMDBNAUJO62/UGFG6EVFMob8/JCje6gr0smOMRJ9bnUxqCFgvlNF Rq1rPZZfegkMN+bO0Ofefp84fqO33xLfSwQErAPZCgzkqc87DRT5T7PfJ1C/KoYz1u2j B4e0dLtGLfCxrv1FtHl/50W0db4dmooJs4s7gclM4VkrqPSk/d1GIeWgRbnHWfQpyZr2 +GW4A7bwjDdYoW4P08KGjJlxdON3o5jPeVnlgcrqUHvTqG7UFpSQVFxF/uh3VHFsYxx0 PyJpvNISw8tKpIWj6zuJMbAqtxH9jD+NRqWFIRwHC/z2GdyqeuqbW/Nk4ekahEPlqqyt Gtpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bA1ijQax; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z13-20020a170903018d00b001adc3a1b3fasi1483979plg.282.2023.06.22.03.39.11; Thu, 22 Jun 2023 03:39:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bA1ijQax; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230320AbjFVKTG (ORCPT <rfc822;maxin.john@gmail.com> + 99 others); Thu, 22 Jun 2023 06:19:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231305AbjFVKTB (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 22 Jun 2023 06:19:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C101111C for <linux-kernel@vger.kernel.org>; Thu, 22 Jun 2023 03:18:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5D99D617BE for <linux-kernel@vger.kernel.org>; Thu, 22 Jun 2023 10:18:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6925BC433C8; Thu, 22 Jun 2023 10:18:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1687429133; bh=xqpXPLyBDps1Cg44j/16UrjMgGR6+mPM7epmRhz78VU=; h=From:To:Cc:Subject:Date:From; b=bA1ijQaxhV2Ba8gH79uS0lA9Q4OSnfs1AflsnyFyATFtOTi3fLv01hAhDvAVYfDLc QQKr8n5PDfVOZU8OhQ8wrRBgI4rNIBO3B9ODSHnF1QZPlPf2xtg0rdiWHKTYRaX5f8 EDI9Nbn/5bJS84IUZK/FDzmfovyJ3Z+dBlTcVw6gpC9Jp3n5sgsnkRshLkxH3Vy7u1 nOvNNsooLRdyAvNfl6hnDO9rf6sAW37Q4f+V55Be6hQxBgWXaHZlWE6T1FQR6PUvLc ecRLU6e90tBq3eFNSdE1i6n3lc31HlBFXgKeQVheZDyingPAcZiudCUWAoypBDay1u OXPhcWKWx0/zA== From: Arnd Bergmann <arnd@kernel.org> To: Jani Nikula <jani.nikula@linux.intel.com>, Joonas Lahtinen <joonas.lahtinen@linux.intel.com>, Rodrigo Vivi <rodrigo.vivi@intel.com>, Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>, David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch> Cc: Arnd Bergmann <arnd@arndb.de>, =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= <ville.syrjala@linux.intel.com>, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH] i915: avoid unused-but-set-variable warning Date: Thu, 22 Jun 2023 12:18:41 +0200 Message-Id: <20230622101848.3482277-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769398982276421796?= X-GMAIL-MSGID: =?utf-8?q?1769398982276421796?= |
Series |
i915: avoid unused-but-set-variable warning
|
|
Commit Message
Arnd Bergmann
June 22, 2023, 10:18 a.m. UTC
From: Arnd Bergmann <arnd@arndb.de> The mchbar_addr variable is only used inside of an #ifdef: drivers/gpu/drm/i915/soc/intel_gmch.c:41:6: error: variable 'mchbar_addr' set but not used [-Werror,-Wunused-but-set-variable] Change this to an IS_ENABLED() check to let the compiler see how it's used and no longer warn about it. Signed-off-by: Arnd Bergmann <arnd@arndb.de> --- drivers/gpu/drm/i915/soc/intel_gmch.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
Comments
Hi Arnd, On Thu, Jun 22, 2023 at 12:18:41PM +0200, Arnd Bergmann wrote: > From: Arnd Bergmann <arnd@arndb.de> > > The mchbar_addr variable is only used inside of an #ifdef: > > drivers/gpu/drm/i915/soc/intel_gmch.c:41:6: error: variable 'mchbar_addr' set but not used [-Werror,-Wunused-but-set-variable] > > Change this to an IS_ENABLED() check to let the compiler see how > it's used and no longer warn about it. > > Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com> Thanks, Andi
Hi Arnd, On Thu, Jun 22, 2023 at 12:18:41PM +0200, Arnd Bergmann wrote: > From: Arnd Bergmann <arnd@arndb.de> > > The mchbar_addr variable is only used inside of an #ifdef: > > drivers/gpu/drm/i915/soc/intel_gmch.c:41:6: error: variable 'mchbar_addr' set but not used [-Werror,-Wunused-but-set-variable] > > Change this to an IS_ENABLED() check to let the compiler see how > it's used and no longer warn about it. > > Signed-off-by: Arnd Bergmann <arnd@arndb.de> > --- > drivers/gpu/drm/i915/soc/intel_gmch.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/i915/soc/intel_gmch.c b/drivers/gpu/drm/i915/soc/intel_gmch.c > index 6d0204942f7a5..49c7fb16e934f 100644 > --- a/drivers/gpu/drm/i915/soc/intel_gmch.c > +++ b/drivers/gpu/drm/i915/soc/intel_gmch.c > @@ -47,11 +47,9 @@ intel_alloc_mchbar_resource(struct drm_i915_private *i915) > mchbar_addr = ((u64)temp_hi << 32) | temp_lo; > > /* If ACPI doesn't have it, assume we need to allocate it ourselves */ > -#ifdef CONFIG_PNP > - if (mchbar_addr && > + if (IS_ENABLED(CONFIG_PNP) && mchbar_addr && > pnp_range_reserved(mchbar_addr, mchbar_addr + MCHBAR_SIZE)) > return 0; > -#endif you actually already sent this same patch[*] and I did push it in drm-intel-next. Andi [*] https://patchwork.freedesktop.org/patch/542054/ > > /* Get some space for it */ > i915->gmch.mch_res.name = "i915 MCHBAR"; > -- > 2.39.2
diff --git a/drivers/gpu/drm/i915/soc/intel_gmch.c b/drivers/gpu/drm/i915/soc/intel_gmch.c index 6d0204942f7a5..49c7fb16e934f 100644 --- a/drivers/gpu/drm/i915/soc/intel_gmch.c +++ b/drivers/gpu/drm/i915/soc/intel_gmch.c @@ -47,11 +47,9 @@ intel_alloc_mchbar_resource(struct drm_i915_private *i915) mchbar_addr = ((u64)temp_hi << 32) | temp_lo; /* If ACPI doesn't have it, assume we need to allocate it ourselves */ -#ifdef CONFIG_PNP - if (mchbar_addr && + if (IS_ENABLED(CONFIG_PNP) && mchbar_addr && pnp_range_reserved(mchbar_addr, mchbar_addr + MCHBAR_SIZE)) return 0; -#endif /* Get some space for it */ i915->gmch.mch_res.name = "i915 MCHBAR";