mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* linux-4.7-rc3/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c:4836: wierd condition ?
@ 2016-06-13  8:16 David Binderman
  2016-06-13 22:52 ` Deucher, Alexander
  0 siblings, 1 reply; 2+ messages in thread
From: David Binderman @ 2016-06-13  8:16 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, airlied, dri-devel,
	linux-kernel, dcb314

Hello there,

linux-4.7-rc3/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c:4836]: (style)
Boolean result is used in bitwise operation. Clarify expression with
parentheses.

Source code is

            if ((ring->me == me_id) & (ring->pipe == pipe_id))

Maybe better code

            if ((ring->me == me_id) && (ring->pipe == pipe_id))

Also in the same file:

[drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c:3866]: (style) Variable 'data'
is assigned a value that is never used.
[drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c:4321]: (style) Variable
'mc_shared_chmap' is assigned a value that is never used.
[drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c:4657]: (style) Variable 'tmp'
is assigned a value that is never used.

Regards

David Binderman

^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: linux-4.7-rc3/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c:4836: wierd condition ?
  2016-06-13  8:16 linux-4.7-rc3/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c:4836: wierd condition ? David Binderman
@ 2016-06-13 22:52 ` Deucher, Alexander
  0 siblings, 0 replies; 2+ messages in thread
From: Deucher, Alexander @ 2016-06-13 22:52 UTC (permalink / raw)
  To: 'David Binderman',
	Koenig, Christian, airlied, dri-devel, linux-kernel, dcb314

[-- Attachment #1: Type: text/plain, Size: 1496 bytes --]

> -----Original Message-----
> From: David Binderman [mailto:linuxdev.baldrick@gmail.com]
> Sent: Monday, June 13, 2016 4:16 AM
> To: Deucher, Alexander; Koenig, Christian; airlied@linux.ie; dri-
> devel@lists.freedesktop.org; linux-kernel@vger.kernel.org;
> dcb314@hotmail.com
> Subject: linux-4.7-rc3/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c:4836:
> wierd condition ?
> 
> Hello there,
> 
> linux-4.7-rc3/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c:4836]: (style)
> Boolean result is used in bitwise operation. Clarify expression with
> parentheses.
> 
> Source code is
> 
>             if ((ring->me == me_id) & (ring->pipe == pipe_id))
> 
> Maybe better code
> 
>             if ((ring->me == me_id) && (ring->pipe == pipe_id))
> 

Good catch.  Fixed in the attached patch.

> Also in the same file:
> 
> [drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c:3866]: (style) Variable 'data'
> is assigned a value that is never used.

The readback of the register here is needed to wake up the block after disabling powergating.

> [drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c:4321]: (style) Variable
> 'mc_shared_chmap' is assigned a value that is never used.

I think this one can be dropped.

> [drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c:4657]: (style) Variable 'tmp'
> is assigned a value that is never used.
> 

This operation requires a posted write (i.e., a read back of the register to make sure the write has completed).

Thanks!

Alex

> Regards
> 
> David Binderman

[-- Attachment #2: 0001-drm-amdgpu-gfx7-fix-broken-condition-check.patch --]
[-- Type: application/octet-stream, Size: 1036 bytes --]

From 8b18300c13a1e08e152f6b6a430faac84f986231 Mon Sep 17 00:00:00 2001
From: Alex Deucher <alexander.deucher@amd.com>
Date: Mon, 13 Jun 2016 18:26:24 -0400
Subject: [PATCH] drm/amdgpu/gfx7: fix broken condition check

Wrong operator.

Reported-by: David Binderman <linuxdev.baldrick@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
---
 drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
index 8c6ad1e..fc8ff4d 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
@@ -4833,7 +4833,7 @@ static int gfx_v7_0_eop_irq(struct amdgpu_device *adev,
 	case 2:
 		for (i = 0; i < adev->gfx.num_compute_rings; i++) {
 			ring = &adev->gfx.compute_ring[i];
-			if ((ring->me == me_id) & (ring->pipe == pipe_id))
+			if ((ring->me == me_id) && (ring->pipe == pipe_id))
 				amdgpu_fence_process(ring);
 		}
 		break;
-- 
2.5.5


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-06-13 22:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-13  8:16 linux-4.7-rc3/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c:4836: wierd condition ? David Binderman
2016-06-13 22:52 ` Deucher, Alexander

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®