Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2335055rwb; Sat, 8 Oct 2022 06:14:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4DlgCz+oq0SiFd4GTMVhsBFoPXQxghMJJYMB1asiJISkweoLYGQeQwbiu2icOHQnh3KTBS X-Received: by 2002:a63:f5c:0:b0:45f:f12d:f469 with SMTP id 28-20020a630f5c000000b0045ff12df469mr3401003pgp.124.1665234868677; Sat, 08 Oct 2022 06:14:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665234868; cv=none; d=google.com; s=arc-20160816; b=JYjs/dOprZXOU5F1Cfjk5AEvkX8NrACaFGjHQeRMFjMsVYDtc5W+kyOKzqzxdhiXes /4BwZTaOyEN87h/cMBjaTvDqBfY18JpiahvYb1JOIoOWlKj6cK15QHzgh/ZIq8qnl0zG 1fxDCAqd5PpNLSXgNCAPg/2eQI5VTmcpSTfUlagxC7ac0FU9Kqlo1LfbN/ILquhkV3gQ FIFFWEJJCRXpQKcMxJ84pbF0P2QcvPexQ320Hv5Oa272Oyq9C6VcrWZoipmC16985hZK 8isXKevrhGg+kJincCtNzguHcyMdf/d0Y38YKg/0QwuXgJFJzwwujEJowmV0MgCbUQ+B 5bcA== 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:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=bo/QFjDkbekFEKZNPQKW6PF2ULdVdCeCYKjRnWtU5Ko=; b=GjyFYyCfBBfkhSZDed/VkryIyl4/Pc2C5C1C4qlpFK9GP5FFRR3p+EO8OtwnQ7GRsL C2ULaf6+cEJLtjTAbPSb5REh8/K4N+IX9K5KTXS2LLybK1oDhhZRjnTPBFYRh0UvD9ri wSg+Ha6tGg9SIUGInikGEbDnk/ziatf80LYy1wlRF8rrC5ZzJwmbT34za/wrbRXiDCa6 zvQEOOfSjDZulSklHfQZF5dXNL6Itz1GUHLAeykwjx9WrujaSmqrwg1mUhRnCsmvx7Xj R5eFSt7yuhMbbVkfHC+bZ4/x1pkTFlAiFIzJ0CHzSqqBHD+lJV0ZubG09uxkXnNVjzJL FW9w== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r11-20020a170902e3cb00b0017f77d25b16si4474051ple.467.2022.10.08.06.14.15; Sat, 08 Oct 2022 06:14:28 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229692AbiJHLzi (ORCPT + 99 others); Sat, 8 Oct 2022 07:55:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229677AbiJHLzf (ORCPT ); Sat, 8 Oct 2022 07:55:35 -0400 Received: from smtp.smtpout.orange.fr (smtp04.smtpout.orange.fr [80.12.242.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 712AE43140 for ; Sat, 8 Oct 2022 04:55:32 -0700 (PDT) Received: from [192.168.1.18] ([86.243.100.34]) by smtp.orange.fr with ESMTPA id h8QOovA5ITyouh8QOoKFYq; Sat, 08 Oct 2022 13:55:27 +0200 X-ME-Helo: [192.168.1.18] X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sat, 08 Oct 2022 13:55:27 +0200 X-ME-IP: 86.243.100.34 Message-ID: <6a57b91b-8614-6596-ae0f-acce6a31d161@wanadoo.fr> Date: Sat, 8 Oct 2022 13:55:24 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH] drm/i915/perf: remove redundant variable 'taken' Content-Language: fr To: Colin Ian King , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , 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> From: Christophe JAILLET In-Reply-To: <20221007195345.2749911-1-colin.i.king@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS 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 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. 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;