Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp379368rwi; Mon, 10 Oct 2022 01:29:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6AFd0c/eGjnCadrH7RoLyJrKzc/SV10NabvHSEMGN6/Ru5DI3bsd2MfCau6h17cB2rj1/M X-Received: by 2002:a17:906:eec9:b0:783:e662:2513 with SMTP id wu9-20020a170906eec900b00783e6622513mr13645128ejb.656.1665390570572; Mon, 10 Oct 2022 01:29:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665390570; cv=none; d=google.com; s=arc-20160816; b=Qa/z/TjQv/BaTEPrTOWO/XCsQ0grxinwq8XJV9z/7/FL7NbqVAauVeYFcCsszh/iTu FjUXs9/iNnMQ4lB7RBSQY+HZQbeHWVHC4mVD3120ffCQg3AH98mWdOe10SdcByiRNuhV l1HOcNzCHwy6i24bFVP1LxCfpNmaBVOWKnmalA+DrLn6JhYoJM365OoSFeTS3gjjTmpf ZJE8KrX5qV+sYHBwsI8s6BaHkxYpSdJQvpZiLda1lxPEWpiOpsD1OdmxSvRJSBEhRgEm n5C/MEbZ6mIHBXeqU/YUG4qTQWJ7S0/Icmm05CbtMlGqAJaUvJFHVDHQEODdjGgF0C9E 36+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:dkim-signature; bh=8LzwahI9ks/c+popd58UPTazc09YPOMe5unmVy5Lr+M=; b=TuLUz7jsU+HrnmNNjgq+0bfFWmFcyu6vxv2XkDRFqEZDpTKpbVvPUnN6kOIcUvYINd BejIBo1TJBcK8kY1LTVoQgzE+DsU0ZxDVqehoPTWj9sBw4/de808jSTApn7WO+0TDxRy LehGZgxnu+hJsobqEPbX/M4Rk05MKGgI2pjYVHh6Nzusv1zPAwxNfND7YGt0x2r4RPzB yZxwjE9/MmTh7mSmCvc/QvM5LJlUgL6uP26NADlkATWJGAdEL+dlzzzdxKdFI/RSVSZ2 jKIgUzYoLNxpRkb0/YOLtMgUiLctW1R7H9C3mOPl/idm05gKWOGV9mDJEH61GRSCMBBv 39ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Jpf49OA8; 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=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y8-20020a056402270800b00458c243d2absi10109769edd.506.2022.10.10.01.29.05; Mon, 10 Oct 2022 01:29:30 -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=@intel.com header.s=Intel header.b=Jpf49OA8; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231701AbiJJIOL (ORCPT + 99 others); Mon, 10 Oct 2022 04:14:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231144AbiJJIOI (ORCPT ); Mon, 10 Oct 2022 04:14:08 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D9DE5280B; Mon, 10 Oct 2022 01:14:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1665389647; x=1696925647; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=nD+TiFgre8EfP7ineZy7SVnMlN+CCTdmpGNG1FzZ/l8=; b=Jpf49OA80ZIZ73AClXGyxTgJHgfdatGxidhZBDZhDB1zftztCxU08lt/ AFfrQPfOrMtghdlNiZuyrVG2XVq+PMv+Tv6FtGar2sTYgAK0f8HHnRh3J fs/YADiDnmH5e9/jLDKAvr4vEotXMZN38Co57HtzhWdGgbCSqgUXhIJGh Lmf8F4sSGK5etPyLB8F9n71+dRS6/o517yLZDXQU8oPEm4EdqRj0V+Pv2 5wWujq2juprhnqQN9FnOdgw+WNG599QfQUHweollVN6+mgdtq2ZU0KrDu NpOijhKLQGj0p9SZeEAf46z9MMJaCDQywzkM2cQH+D9PBUK0cMOEEjcbk w==; X-IronPort-AV: E=McAfee;i="6500,9779,10495"; a="283896881" X-IronPort-AV: E=Sophos;i="5.95,173,1661842800"; d="scan'208";a="283896881" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Oct 2022 01:14:05 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10495"; a="694544256" X-IronPort-AV: E=Sophos;i="5.95,173,1661842800"; d="scan'208";a="694544256" Received: from liammurp-mobl1.ger.corp.intel.com (HELO [10.213.197.233]) ([10.213.197.233]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Oct 2022 01:14:03 -0700 Message-ID: <96ba4258-4195-3a6a-e296-291f93a0b8de@linux.intel.com> Date: Mon, 10 Oct 2022 09:14:02 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.2 Subject: Re: [PATCH] drm/i915/perf: remove redundant variable 'taken' Content-Language: en-US To: Christophe JAILLET , Colin Ian King , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , David Airlie , Daniel Vetter , intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org References: <20221007195345.2749911-1-colin.i.king@gmail.com> <6a57b91b-8614-6596-ae0f-acce6a31d161@wanadoo.fr> From: Tvrtko Ursulin Organization: Intel Corporation UK Plc In-Reply-To: <6a57b91b-8614-6596-ae0f-acce6a31d161@wanadoo.fr> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,HK_RANDOM_ENVFROM,HK_RANDOM_FROM, NICE_REPLY_A,RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_NONE 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: X-Mailing-List: linux-kernel@vger.kernel.org On 08/10/2022 12:55, Christophe JAILLET wrote: > Le 07/10/2022 à 21:53, Colin Ian King a écrit : >> The assignment to variable taken is redundant and so it can be >> removed as well as the variable too. >> >> Cleans up clang-scan build warnings: >> warning: Although the value stored to 'taken' is used in the enclosing >> expression, the value is never actually read from 'taken' >> [deadcode.DeadStores] > > Hi, > > #define OA_TAKEN(tail, head)    ((tail - head) & (OA_BUFFER_SIZE - 1)) > > So if the result is not used, maybe calling OA_TAKEN() can be removed as > well? > It looks like a no-op in such a case. AFAICS result is used, just the copy/local variable is not. For the patch: Reviewed-by: Tvrtko Ursulin Thanks for the cleanup, will merge. Regards, Tvrtko > > CJ > >> >> Signed-off-by: Colin Ian King >> --- >>   drivers/gpu/drm/i915/i915_perf.c | 6 ++---- >>   1 file changed, 2 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/gpu/drm/i915/i915_perf.c >> b/drivers/gpu/drm/i915/i915_perf.c >> index 0defbb43ceea..15816df916c7 100644 >> --- a/drivers/gpu/drm/i915/i915_perf.c >> +++ b/drivers/gpu/drm/i915/i915_perf.c >> @@ -656,7 +656,6 @@ static int gen8_append_oa_reports(struct >> i915_perf_stream *stream, >>       size_t start_offset = *offset; >>       unsigned long flags; >>       u32 head, tail; >> -    u32 taken; >>       int ret = 0; >>       if (drm_WARN_ON(&uncore->i915->drm, !stream->enabled)) >> @@ -692,7 +691,7 @@ static int gen8_append_oa_reports(struct >> i915_perf_stream *stream, >>       for (/* none */; >> -         (taken = OA_TAKEN(tail, head)); >> +         OA_TAKEN(tail, head); >>            head = (head + report_size) & mask) { >>           u8 *report = oa_buf_base + head; >>           u32 *report32 = (void *)report; >> @@ -950,7 +949,6 @@ static int gen7_append_oa_reports(struct >> i915_perf_stream *stream, >>       size_t start_offset = *offset; >>       unsigned long flags; >>       u32 head, tail; >> -    u32 taken; >>       int ret = 0; >>       if (drm_WARN_ON(&uncore->i915->drm, !stream->enabled)) >> @@ -984,7 +982,7 @@ static int gen7_append_oa_reports(struct >> i915_perf_stream *stream, >>       for (/* none */; >> -         (taken = OA_TAKEN(tail, head)); >> +         OA_TAKEN(tail, head); >>            head = (head + report_size) & mask) { >>           u8 *report = oa_buf_base + head; >>           u32 *report32 = (void *)report; >