2020-04-10 19:24:06

by Colin King

[permalink] [raw]
Subject: [PATCH] drm/i915/gt: remove redundant assignment to variable x

From: Colin Ian King <[email protected]>

The variable x is being initialized with a value that is never read
and it is being updated later with a new value. The initialization is
redundant and can be removed.

Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <[email protected]>
---
drivers/gpu/drm/i915/gt/intel_engine_cs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_engine_cs.c b/drivers/gpu/drm/i915/gt/intel_engine_cs.c
index 3aa8a652c16d..0b597427bde9 100644
--- a/drivers/gpu/drm/i915/gt/intel_engine_cs.c
+++ b/drivers/gpu/drm/i915/gt/intel_engine_cs.c
@@ -1205,7 +1205,7 @@ static void print_request(struct drm_printer *m,
{
const char *name = rq->fence.ops->get_timeline_name(&rq->fence);
char buf[80] = "";
- int x = 0;
+ int x;

x = print_sched_attr(rq->i915, &rq->sched.attr, buf, x, sizeof(buf));

--
2.25.1


2020-04-14 15:11:49

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH] drm/i915/gt: remove redundant assignment to variable x

Hi Colin,

url: https://github.com/0day-ci/linux/commits/Colin-King/drm-i915-gt-remove-redundant-assignment-to-variable-x/20200411-032731
base: git://anongit.freedesktop.org/drm-intel for-linux-next

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <[email protected]>
Reported-by: Dan Carpenter <[email protected]>

smatch warnings:
drivers/gpu/drm/i915/gt/intel_engine_cs.c:1210 print_request() error: uninitialized symbol 'x'.

# https://github.com/0day-ci/linux/commit/6ee08d455bba0066e8f5f276dcd43d9e3e594dc5
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 6ee08d455bba0066e8f5f276dcd43d9e3e594dc5
vim +/x +1210 drivers/gpu/drm/i915/gt/intel_engine_cs.c

f636edb214a5ff drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2017-10-09 1202 static void print_request(struct drm_printer *m,
e61e0f51ba7974 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-02-21 1203 struct i915_request *rq,
f636edb214a5ff drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2017-10-09 1204 const char *prefix)
f636edb214a5ff drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2017-10-09 1205 {
ab2681512b4c10 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-03-14 1206 const char *name = rq->fence.ops->get_timeline_name(&rq->fence);
96d4f03c20d04c drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-05-17 1207 char buf[80] = "";
6ee08d455bba00 drivers/gpu/drm/i915/gt/intel_engine_cs.c Colin Ian King 2020-04-10 1208 int x;
^^^^^

247870ac8ea729 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-04-24 1209
247870ac8ea729 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-04-24 @1210 x = print_sched_attr(rq->i915, &rq->sched.attr, buf, x, sizeof(buf));
^
Uninitialized variable

ab2681512b4c10 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-03-14 1211
b300fde8965fdd drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2019-02-26 1212 drm_printf(m, "%s %llx:%llx%s%s %s @ %dms: %s\n",
b7268c5eed0ab4 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-04-18 1213 prefix,
b300fde8965fdd drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2019-02-26 1214 rq->fence.context, rq->fence.seqno,
8547444137ec61 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2019-01-29 1215 i915_request_completed(rq) ? "!" :
8547444137ec61 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2019-01-29 1216 i915_request_started(rq) ? "*" :
8547444137ec61 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2019-01-29 1217 "",
8c334f24e3b448 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2019-05-01 1218 test_bit(DMA_FENCE_FLAG_SIGNALED_BIT,
8c334f24e3b448 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2019-05-01 1219 &rq->fence.flags) ? "+" :
52c0fdb25c7c91 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2019-01-29 1220 test_bit(DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT,
8c334f24e3b448 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2019-05-01 1221 &rq->fence.flags) ? "-" :
8c334f24e3b448 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2019-05-01 1222 "",
247870ac8ea729 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-04-24 1223 buf,
f636edb214a5ff drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2017-10-09 1224 jiffies_to_msecs(jiffies - rq->emitted_jiffies),
ab2681512b4c10 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-03-14 1225 name);
f636edb214a5ff drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2017-10-09 1226 }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]

2020-04-15 18:27:01

by Colin King

[permalink] [raw]
Subject: Re: [PATCH] drm/i915/gt: remove redundant assignment to variable x

Hi Dan,

I'd post a revert, but I don't seem to see an upstream commit for this
this to revert against. What's the revert policy in these cases? Or can
the patch be just ignored by the maintainers so it's not applied?

Colin


On 14/04/2020 10:23, Dan Carpenter wrote:
> Hi Colin,
>
> url: https://github.com/0day-ci/linux/commits/Colin-King/drm-i915-gt-remove-redundant-assignment-to-variable-x/20200411-032731
> base: git://anongit.freedesktop.org/drm-intel for-linux-next
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kbuild test robot <[email protected]>
> Reported-by: Dan Carpenter <[email protected]>
>
> smatch warnings:
> drivers/gpu/drm/i915/gt/intel_engine_cs.c:1210 print_request() error: uninitialized symbol 'x'.
>
> # https://github.com/0day-ci/linux/commit/6ee08d455bba0066e8f5f276dcd43d9e3e594dc5
> git remote add linux-review https://github.com/0day-ci/linux
> git remote update linux-review
> git checkout 6ee08d455bba0066e8f5f276dcd43d9e3e594dc5
> vim +/x +1210 drivers/gpu/drm/i915/gt/intel_engine_cs.c
>
> f636edb214a5ff drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2017-10-09 1202 static void print_request(struct drm_printer *m,
> e61e0f51ba7974 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-02-21 1203 struct i915_request *rq,
> f636edb214a5ff drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2017-10-09 1204 const char *prefix)
> f636edb214a5ff drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2017-10-09 1205 {
> ab2681512b4c10 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-03-14 1206 const char *name = rq->fence.ops->get_timeline_name(&rq->fence);
> 96d4f03c20d04c drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-05-17 1207 char buf[80] = "";
> 6ee08d455bba00 drivers/gpu/drm/i915/gt/intel_engine_cs.c Colin Ian King 2020-04-10 1208 int x;
> ^^^^^
>
> 247870ac8ea729 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-04-24 1209
> 247870ac8ea729 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-04-24 @1210 x = print_sched_attr(rq->i915, &rq->sched.attr, buf, x, sizeof(buf));
> ^
> Uninitialized variable
>
> ab2681512b4c10 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-03-14 1211
> b300fde8965fdd drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2019-02-26 1212 drm_printf(m, "%s %llx:%llx%s%s %s @ %dms: %s\n",
> b7268c5eed0ab4 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-04-18 1213 prefix,
> b300fde8965fdd drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2019-02-26 1214 rq->fence.context, rq->fence.seqno,
> 8547444137ec61 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2019-01-29 1215 i915_request_completed(rq) ? "!" :
> 8547444137ec61 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2019-01-29 1216 i915_request_started(rq) ? "*" :
> 8547444137ec61 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2019-01-29 1217 "",
> 8c334f24e3b448 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2019-05-01 1218 test_bit(DMA_FENCE_FLAG_SIGNALED_BIT,
> 8c334f24e3b448 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2019-05-01 1219 &rq->fence.flags) ? "+" :
> 52c0fdb25c7c91 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2019-01-29 1220 test_bit(DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT,
> 8c334f24e3b448 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2019-05-01 1221 &rq->fence.flags) ? "-" :
> 8c334f24e3b448 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2019-05-01 1222 "",
> 247870ac8ea729 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-04-24 1223 buf,
> f636edb214a5ff drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2017-10-09 1224 jiffies_to_msecs(jiffies - rq->emitted_jiffies),
> ab2681512b4c10 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-03-14 1225 name);
> f636edb214a5ff drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2017-10-09 1226 }
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/[email protected]
>

2020-04-15 22:46:34

by Jani Nikula

[permalink] [raw]
Subject: Re: [PATCH] drm/i915/gt: remove redundant assignment to variable x

On Tue, 14 Apr 2020, Colin Ian King <[email protected]> wrote:
> Hi Dan,
>
> I'd post a revert, but I don't seem to see an upstream commit for this
> this to revert against. What's the revert policy in these cases? Or can
> the patch be just ignored by the maintainers so it's not applied?

It has not been applied, and will be ignored, in part thanks to the
report.

However I think Dan's report is misleading in that it looks like it's
about a commit while I think it should emphasize that it's a pre-merge
report on the patch on the mailing list.

BR,
Jani.



>
> Colin
>
>
> On 14/04/2020 10:23, Dan Carpenter wrote:
>> Hi Colin,
>>
>> url: https://github.com/0day-ci/linux/commits/Colin-King/drm-i915-gt-remove-redundant-assignment-to-variable-x/20200411-032731
>> base: git://anongit.freedesktop.org/drm-intel for-linux-next
>>
>> If you fix the issue, kindly add following tag as appropriate
>> Reported-by: kbuild test robot <[email protected]>
>> Reported-by: Dan Carpenter <[email protected]>
>>
>> smatch warnings:
>> drivers/gpu/drm/i915/gt/intel_engine_cs.c:1210 print_request() error: uninitialized symbol 'x'.
>>
>> # https://github.com/0day-ci/linux/commit/6ee08d455bba0066e8f5f276dcd43d9e3e594dc5
>> git remote add linux-review https://github.com/0day-ci/linux
>> git remote update linux-review
>> git checkout 6ee08d455bba0066e8f5f276dcd43d9e3e594dc5
>> vim +/x +1210 drivers/gpu/drm/i915/gt/intel_engine_cs.c
>>
>> f636edb214a5ff drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2017-10-09 1202 static void print_request(struct drm_printer *m,
>> e61e0f51ba7974 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-02-21 1203 struct i915_request *rq,
>> f636edb214a5ff drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2017-10-09 1204 const char *prefix)
>> f636edb214a5ff drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2017-10-09 1205 {
>> ab2681512b4c10 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-03-14 1206 const char *name = rq->fence.ops->get_timeline_name(&rq->fence);
>> 96d4f03c20d04c drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-05-17 1207 char buf[80] = "";
>> 6ee08d455bba00 drivers/gpu/drm/i915/gt/intel_engine_cs.c Colin Ian King 2020-04-10 1208 int x;
>> ^^^^^
>>
>> 247870ac8ea729 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-04-24 1209
>> 247870ac8ea729 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-04-24 @1210 x = print_sched_attr(rq->i915, &rq->sched.attr, buf, x, sizeof(buf));
>> ^
>> Uninitialized variable
>>
>> ab2681512b4c10 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-03-14 1211
>> b300fde8965fdd drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2019-02-26 1212 drm_printf(m, "%s %llx:%llx%s%s %s @ %dms: %s\n",
>> b7268c5eed0ab4 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-04-18 1213 prefix,
>> b300fde8965fdd drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2019-02-26 1214 rq->fence.context, rq->fence.seqno,
>> 8547444137ec61 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2019-01-29 1215 i915_request_completed(rq) ? "!" :
>> 8547444137ec61 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2019-01-29 1216 i915_request_started(rq) ? "*" :
>> 8547444137ec61 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2019-01-29 1217 "",
>> 8c334f24e3b448 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2019-05-01 1218 test_bit(DMA_FENCE_FLAG_SIGNALED_BIT,
>> 8c334f24e3b448 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2019-05-01 1219 &rq->fence.flags) ? "+" :
>> 52c0fdb25c7c91 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2019-01-29 1220 test_bit(DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT,
>> 8c334f24e3b448 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2019-05-01 1221 &rq->fence.flags) ? "-" :
>> 8c334f24e3b448 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2019-05-01 1222 "",
>> 247870ac8ea729 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-04-24 1223 buf,
>> f636edb214a5ff drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2017-10-09 1224 jiffies_to_msecs(jiffies - rq->emitted_jiffies),
>> ab2681512b4c10 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-03-14 1225 name);
>> f636edb214a5ff drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2017-10-09 1226 }
>>
>> ---
>> 0-DAY CI Kernel Test Service, Intel Corporation
>> https://lists.01.org/hyperkitty/list/[email protected]
>>
>

--
Jani Nikula, Intel Open Source Graphics Center

2020-04-16 08:42:51

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH] drm/i915/gt: remove redundant assignment to variable x

On Wed, Apr 15, 2020 at 12:07:44PM +0300, Jani Nikula wrote:
> On Tue, 14 Apr 2020, Colin Ian King <[email protected]> wrote:
> > Hi Dan,
> >
> > I'd post a revert, but I don't seem to see an upstream commit for this
> > this to revert against. What's the revert policy in these cases? Or can
> > the patch be just ignored by the maintainers so it's not applied?
>
> It has not been applied, and will be ignored, in part thanks to the
> report.
>
> However I think Dan's report is misleading in that it looks like it's
> about a commit while I think it should emphasize that it's a pre-merge
> report on the patch on the mailing list.
>

To be honest, these are auto-generated by the kbuild bot and I was a bit
confused myself.

regards,
dan carpenter