amd-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] drm/amdgpu: Fix a couple of clang warnings
@ 2022-05-04 22:24 Mike Lothian
  2022-05-04 22:24 ` [PATCH 1/2] drm/amdgpu/gfx10: Avoid uninitialised variable 'index' Mike Lothian
  2022-05-04 22:24 ` [PATCH 2/2] drm/amdgpu/gfx11: " Mike Lothian
  0 siblings, 2 replies; 4+ messages in thread
From: Mike Lothian @ 2022-05-04 22:24 UTC (permalink / raw)
  To: amd-gfx; +Cc: Mike Lothian

The 3rd patch from the previous series was already applied

This reworks the other two based on Alex's comments

Mike Lothian (2):
  drm/amdgpu/gfx10: Avoid uninitialised variable 'index'
  drm/amdgpu/gfx11: Avoid uninitialised variable 'index'

 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 3 ++-
 drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

-- 
2.35.1


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

* [PATCH 1/2] drm/amdgpu/gfx10: Avoid uninitialised variable 'index'
  2022-05-04 22:24 [PATCH v2 0/2] drm/amdgpu: Fix a couple of clang warnings Mike Lothian
@ 2022-05-04 22:24 ` Mike Lothian
  2022-05-04 22:24 ` [PATCH 2/2] drm/amdgpu/gfx11: " Mike Lothian
  1 sibling, 0 replies; 4+ messages in thread
From: Mike Lothian @ 2022-05-04 22:24 UTC (permalink / raw)
  To: amd-gfx; +Cc: Mike Lothian

This stops clang complaining:

drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c:3846:6: warning: variable 'index' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
        if (ring->is_mes_queue) {
            ^~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c:3903:30: note: uninitialized use occurs here
        amdgpu_device_wb_free(adev, index);
                                    ^~~~~
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c:3846:2: note: remove the 'if' if its condition is always false
        if (ring->is_mes_queue) {
        ^~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c:3839:16: note: initialize the variable 'index' to silence this warning
        unsigned index;
                      ^
                       = 0

Signed-off-by: Mike Lothian <mike@fireburn.co.uk>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
index fc289ee54a47..043f8bc37f21 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
@@ -3900,7 +3900,8 @@ static int gfx_v10_0_ring_test_ib(struct amdgpu_ring *ring, long timeout)
 		amdgpu_ib_free(adev, &ib, NULL);
 	dma_fence_put(f);
 err1:
-	amdgpu_device_wb_free(adev, index);
+	if (!ring->is_mes_queue)
+		amdgpu_device_wb_free(adev, index);
 	return r;
 }
 
-- 
2.35.1


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

* [PATCH 2/2] drm/amdgpu/gfx11: Avoid uninitialised variable 'index'
  2022-05-04 22:24 [PATCH v2 0/2] drm/amdgpu: Fix a couple of clang warnings Mike Lothian
  2022-05-04 22:24 ` [PATCH 1/2] drm/amdgpu/gfx10: Avoid uninitialised variable 'index' Mike Lothian
@ 2022-05-04 22:24 ` Mike Lothian
  2022-05-05  2:21   ` Alex Deucher
  1 sibling, 1 reply; 4+ messages in thread
From: Mike Lothian @ 2022-05-04 22:24 UTC (permalink / raw)
  To: amd-gfx; +Cc: Mike Lothian

This stops clang complaining:

drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c:376:6: warning: variable 'index' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
        if (ring->is_mes_queue) {
            ^~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c:433:30: note: uninitialized use occurs here
        amdgpu_device_wb_free(adev, index);
                                    ^~~~~
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c:376:2: note: remove the 'if' if its condition is always false
        if (ring->is_mes_queue) {
        ^~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c:364:16: note: initialize the variable 'index' to silence this warning
        unsigned index;
                      ^
                       = 0

Signed-off-by: Mike Lothian <mike@fireburn.co.uk>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
index 141c64636577..c5655128fd9c 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
@@ -430,7 +430,8 @@ static int gfx_v11_0_ring_test_ib(struct amdgpu_ring *ring, long timeout)
 		amdgpu_ib_free(adev, &ib, NULL);
 	dma_fence_put(f);
 err1:
-	amdgpu_device_wb_free(adev, index);
+	if (!ring->is_mes_queue)
+		amdgpu_device_wb_free(adev, index);
 	return r;
 }
 
-- 
2.35.1


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

* Re: [PATCH 2/2] drm/amdgpu/gfx11: Avoid uninitialised variable 'index'
  2022-05-04 22:24 ` [PATCH 2/2] drm/amdgpu/gfx11: " Mike Lothian
@ 2022-05-05  2:21   ` Alex Deucher
  0 siblings, 0 replies; 4+ messages in thread
From: Alex Deucher @ 2022-05-05  2:21 UTC (permalink / raw)
  To: Mike Lothian; +Cc: amd-gfx list

Applied the series.  Thanks!

Alex

On Wed, May 4, 2022 at 6:24 PM Mike Lothian <mike@fireburn.co.uk> wrote:
>
> This stops clang complaining:
>
> drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c:376:6: warning: variable 'index' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
>         if (ring->is_mes_queue) {
>             ^~~~~~~~~~~~~~~~~~
> drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c:433:30: note: uninitialized use occurs here
>         amdgpu_device_wb_free(adev, index);
>                                     ^~~~~
> drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c:376:2: note: remove the 'if' if its condition is always false
>         if (ring->is_mes_queue) {
>         ^~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c:364:16: note: initialize the variable 'index' to silence this warning
>         unsigned index;
>                       ^
>                        = 0
>
> Signed-off-by: Mike Lothian <mike@fireburn.co.uk>
> ---
>  drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
> index 141c64636577..c5655128fd9c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
> @@ -430,7 +430,8 @@ static int gfx_v11_0_ring_test_ib(struct amdgpu_ring *ring, long timeout)
>                 amdgpu_ib_free(adev, &ib, NULL);
>         dma_fence_put(f);
>  err1:
> -       amdgpu_device_wb_free(adev, index);
> +       if (!ring->is_mes_queue)
> +               amdgpu_device_wb_free(adev, index);
>         return r;
>  }
>
> --
> 2.35.1
>

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

end of thread, other threads:[~2022-05-05  2:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-04 22:24 [PATCH v2 0/2] drm/amdgpu: Fix a couple of clang warnings Mike Lothian
2022-05-04 22:24 ` [PATCH 1/2] drm/amdgpu/gfx10: Avoid uninitialised variable 'index' Mike Lothian
2022-05-04 22:24 ` [PATCH 2/2] drm/amdgpu/gfx11: " Mike Lothian
2022-05-05  2:21   ` Alex Deucher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).