[PATCH -next] drm/amdgpu: fix unused-but-set-variable warnings

Alex Deucher alexdeucher at gmail.com
Thu May 20 19:28:52 UTC 2021


Applied.  Thanks!

On Thu, May 20, 2021 at 9:32 AM Wei Yongjun <weiyongjun1 at huawei.com> wrote:
>
> GCC reports the following warnings with W=1:
>
> drivers/gpu/drm/amd/amdgpu/jpeg_v2_5.c:190:22: warning:
>  variable 'ring' set but not used [-Wunused-but-set-variable]
>   190 |  struct amdgpu_ring *ring;
>       |                      ^~~~
> drivers/gpu/drm/amd/amdgpu/jpeg_v3_0.c:162:22: warning:
>  variable 'ring' set but not used [-Wunused-but-set-variable]
>   162 |  struct amdgpu_ring *ring;
>       |                      ^~~~
> drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c:383:22: warning:
>  variable 'ring' set but not used [-Wunused-but-set-variable]
>   383 |  struct amdgpu_ring *ring;
>       |                      ^~~~
>
> Those variables are not really used, so remove them
> to fix the warnings.
>
> Reported-by: Hulk Robot <hulkci at huawei.com>
> Signed-off-by: Wei Yongjun <weiyongjun1 at huawei.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/jpeg_v2_5.c | 2 --
>  drivers/gpu/drm/amd/amdgpu/jpeg_v3_0.c | 2 --
>  drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c  | 3 ---
>  3 file changed, 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/jpeg_v2_5.c b/drivers/gpu/drm/amd/amdgpu/jpeg_v2_5.c
> index 938ef4ce5b76..af6f45c3f6fc 100644
> --- a/drivers/gpu/drm/amd/amdgpu/jpeg_v2_5.c
> +++ b/drivers/gpu/drm/amd/amdgpu/jpeg_v2_5.c
> @@ -187,14 +187,12 @@ static int jpeg_v2_5_hw_init(void *handle)
>  static int jpeg_v2_5_hw_fini(void *handle)
>  {
>         struct amdgpu_device *adev = (struct amdgpu_device *)handle;
> -       struct amdgpu_ring *ring;
>         int i;
>
>         for (i = 0; i < adev->jpeg.num_jpeg_inst; ++i) {
>                 if (adev->jpeg.harvest_config & (1 << i))
>                         continue;
>
> -               ring = &adev->jpeg.inst[i].ring_dec;
>                 if (adev->jpeg.cur_state != AMD_PG_STATE_GATE &&
>                       RREG32_SOC15(JPEG, i, mmUVD_JRBC_STATUS))
>                         jpeg_v2_5_set_powergating_state(adev, AMD_PG_STATE_GATE);
> diff --git a/drivers/gpu/drm/amd/amdgpu/jpeg_v3_0.c b/drivers/gpu/drm/amd/amdgpu/jpeg_v3_0.c
> index 94be35357f7d..b4d53d1a6123 100644
> --- a/drivers/gpu/drm/amd/amdgpu/jpeg_v3_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/jpeg_v3_0.c
> @@ -159,9 +159,7 @@ static int jpeg_v3_0_hw_init(void *handle)
>  static int jpeg_v3_0_hw_fini(void *handle)
>  {
>         struct amdgpu_device *adev = (struct amdgpu_device *)handle;
> -       struct amdgpu_ring *ring;
>
> -       ring = &adev->jpeg.inst->ring_dec;
>         if (adev->jpeg.cur_state != AMD_PG_STATE_GATE &&
>               RREG32_SOC15(JPEG, 0, mmUVD_JRBC_STATUS))
>                 jpeg_v3_0_set_powergating_state(adev, AMD_PG_STATE_GATE);
> diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c b/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c
> index 946335d0f19c..d60358767d10 100644
> --- a/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c
> @@ -380,15 +380,12 @@ static int vcn_v3_0_hw_init(void *handle)
>  static int vcn_v3_0_hw_fini(void *handle)
>  {
>         struct amdgpu_device *adev = (struct amdgpu_device *)handle;
> -       struct amdgpu_ring *ring;
>         int i;
>
>         for (i = 0; i < adev->vcn.num_vcn_inst; ++i) {
>                 if (adev->vcn.harvest_config & (1 << i))
>                         continue;
>
> -               ring = &adev->vcn.inst[i].ring_dec;
> -
>                 if (!amdgpu_sriov_vf(adev)) {
>                         if ((adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG) ||
>                                         (adev->vcn.cur_state != AMD_PG_STATE_GATE &&


More information about the amd-gfx mailing list