public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
	Colin Ian King <colin.i.king@gmail.com>,
	Jani Nikula <jani.nikula@linux.intel.com>,
	Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>,
	David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
	intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm/i915/perf: remove redundant variable 'taken'
Date: Mon, 10 Oct 2022 09:14:02 +0100	[thread overview]
Message-ID: <96ba4258-4195-3a6a-e296-291f93a0b8de@linux.intel.com> (raw)
In-Reply-To: <6a57b91b-8614-6596-ae0f-acce6a31d161@wanadoo.fr>


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 <tvrtko.ursulin@intel.com>

Thanks for the cleanup, will merge.

Regards,

Tvrtko


> 
> CJ
> 
>>
>> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
>> ---
>>   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;
> 

      reply	other threads:[~2022-10-10  8:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-07 19:53 [PATCH] drm/i915/perf: remove redundant variable 'taken' Colin Ian King
2022-10-08 11:55 ` Christophe JAILLET
2022-10-10  8:14   ` Tvrtko Ursulin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=96ba4258-4195-3a6a-e296-291f93a0b8de@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=airlied@gmail.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=colin.i.king@gmail.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rodrigo.vivi@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox