Re: [PATCH] drm/amdgpu: Remove unused variable in amdgpu_gfx.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 23, 2023 at 2:31 PM Srinivasan Shanmugam
<srinivasan.shanmugam@xxxxxxx> wrote:
>
> drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c: In function ‘amdgpu_gfx_disable_kcq’:
> drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:497:6: warning: variable ‘j’ set but not used [-Wunused-but-set-variable]
>   497 |  int j;
>       |      ^
> drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c: In function ‘amdgpu_gfx_disable_kgq’:
> drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:528:6: warning: variable ‘j’ set but not used [-Wunused-but-set-variable]
>   528 |  int j;
>       |      ^
> drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c: In function ‘amdgpu_gfx_enable_kgq’:
> drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:630:12: warning: variable ‘j’ set but not used [-Wunused-but-set-variable]
>   630 |  int r, i, j;
>       |
>
> This variable is not used so remove them.
>
> Cc: Alex Deucher <alexander.deucher@xxxxxxx>
> Cc: Christian König <christian.koenig@xxxxxxx>
> Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@xxxxxxx>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 16 ++++------------
>  1 file changed, 4 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> index 2b4bf6c11ae4..c7c16d6c476a 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> @@ -494,7 +494,6 @@ int amdgpu_gfx_disable_kcq(struct amdgpu_device *adev, int xcc_id)
>         struct amdgpu_kiq *kiq = &adev->gfx.kiq[xcc_id];
>         struct amdgpu_ring *kiq_ring = &kiq->ring;
>         int i, r = 0;
> -       int j;
>
>         if (!kiq->pmf || !kiq->pmf->kiq_unmap_queues)
>                 return -EINVAL;
> @@ -506,12 +505,10 @@ int amdgpu_gfx_disable_kcq(struct amdgpu_device *adev, int xcc_id)
>                 return -ENOMEM;
>         }
>
> -       for (i = 0; i < adev->gfx.num_compute_rings; i++) {
> -               j = i + xcc_id * adev->gfx.num_compute_rings;
> +       for (i = 0; i < adev->gfx.num_compute_rings; i++)
>                 kiq->pmf->kiq_unmap_queues(kiq_ring,
>                                            &adev->gfx.compute_ring[i],

I think this should probably be j here rather than i.  Same for the
functions below.  I swear I saw a patch which fixed this, but maybe it
never landed?

Alex

>                                            RESET_QUEUES, 0, 0);
> -       }
>
>         if (kiq_ring->sched.ready && !adev->job_hang)
>                 r = amdgpu_ring_test_helper(kiq_ring);
> @@ -525,7 +522,6 @@ int amdgpu_gfx_disable_kgq(struct amdgpu_device *adev, int xcc_id)
>         struct amdgpu_kiq *kiq = &adev->gfx.kiq[xcc_id];
>         struct amdgpu_ring *kiq_ring = &kiq->ring;
>         int i, r = 0;
> -       int j;
>
>         if (!kiq->pmf || !kiq->pmf->kiq_unmap_queues)
>                 return -EINVAL;
> @@ -538,12 +534,10 @@ int amdgpu_gfx_disable_kgq(struct amdgpu_device *adev, int xcc_id)
>                         return -ENOMEM;
>                 }
>
> -               for (i = 0; i < adev->gfx.num_gfx_rings; i++) {
> -                       j = i + xcc_id * adev->gfx.num_gfx_rings;
> +               for (i = 0; i < adev->gfx.num_gfx_rings; i++)
>                         kiq->pmf->kiq_unmap_queues(kiq_ring,
>                                                    &adev->gfx.gfx_ring[i],
>                                                    PREEMPT_QUEUES, 0, 0);
> -               }
>         }
>
>         if (adev->gfx.kiq[0].ring.sched.ready && !adev->job_hang)
> @@ -627,7 +621,7 @@ int amdgpu_gfx_enable_kgq(struct amdgpu_device *adev, int xcc_id)
>  {
>         struct amdgpu_kiq *kiq = &adev->gfx.kiq[xcc_id];
>         struct amdgpu_ring *kiq_ring = &kiq->ring;
> -       int r, i, j;
> +       int r, i;
>
>         if (!kiq->pmf || !kiq->pmf->kiq_map_queues)
>                 return -EINVAL;
> @@ -645,11 +639,9 @@ int amdgpu_gfx_enable_kgq(struct amdgpu_device *adev, int xcc_id)
>                         return r;
>                 }
>
> -               for (i = 0; i < adev->gfx.num_gfx_rings; i++) {
> -                       j = i + xcc_id * adev->gfx.num_gfx_rings;
> +               for (i = 0; i < adev->gfx.num_gfx_rings; i++)
>                         kiq->pmf->kiq_map_queues(kiq_ring,
>                                                  &adev->gfx.gfx_ring[i]);
> -               }
>         }
>
>         r = amdgpu_ring_test_helper(kiq_ring);
> --
> 2.25.1
>




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux