diff mbox series

drm/amdgpu: Fix uninitialized warning in mmhub_v2_0_get_clockgating()

Message ID 20221024151953.2238616-1-nathan@kernel.org (mailing list archive)
State New, archived
Headers show
Series drm/amdgpu: Fix uninitialized warning in mmhub_v2_0_get_clockgating() | expand

Commit Message

Nathan Chancellor Oct. 24, 2022, 3:19 p.m. UTC
Clang warns:

  drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c:686:3: error: variable 'data' is uninitialized when used here [-Werror,-Wuninitialized]
                  data |= MM_ATC_L2_MISC_CG__ENABLE_MASK;
                  ^~~~
  drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c:674:10: note: initialize the variable 'data' to silence this warning
          int data, data1;
                  ^
                  = 0
  1 error generated.

This clearly should have just been a regular '=', as there was no prior
assignment.

Fixes: 7a4fad619819 ("drm/amdgpu: Remove ATC L2 access for MMHUB 2.1.x")
Link: https://github.com/ClangBuiltLinux/linux/issues/1748
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
 drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


base-commit: fb5e487f910e1105019b883e8ed25e36e4bfd657

Comments

Alex Deucher Oct. 24, 2022, 3:26 p.m. UTC | #1
Applied.  Thanks!

Alex

On Mon, Oct 24, 2022 at 11:20 AM Nathan Chancellor <nathan@kernel.org> wrote:
>
> Clang warns:
>
>   drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c:686:3: error: variable 'data' is uninitialized when used here [-Werror,-Wuninitialized]
>                   data |= MM_ATC_L2_MISC_CG__ENABLE_MASK;
>                   ^~~~
>   drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c:674:10: note: initialize the variable 'data' to silence this warning
>           int data, data1;
>                   ^
>                   = 0
>   1 error generated.
>
> This clearly should have just been a regular '=', as there was no prior
> assignment.
>
> Fixes: 7a4fad619819 ("drm/amdgpu: Remove ATC L2 access for MMHUB 2.1.x")
> Link: https://github.com/ClangBuiltLinux/linux/issues/1748
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
>  drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c b/drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c
> index 5ec6d17fed09..998b5d17b271 100644
> --- a/drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c
> @@ -683,7 +683,7 @@ static void mmhub_v2_0_get_clockgating(struct amdgpu_device *adev, u64 *flags)
>                 /* There is no ATCL2 in MMHUB for 2.1.x. Keep the status
>                  * based on DAGB
>                  */
> -               data |= MM_ATC_L2_MISC_CG__ENABLE_MASK;
> +               data = MM_ATC_L2_MISC_CG__ENABLE_MASK;
>                 data1 = RREG32_SOC15(MMHUB, 0, mmDAGB0_CNTL_MISC2_Sienna_Cichlid);
>                 break;
>         default:
>
> base-commit: fb5e487f910e1105019b883e8ed25e36e4bfd657
> --
> 2.38.1
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c b/drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c
index 5ec6d17fed09..998b5d17b271 100644
--- a/drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c
@@ -683,7 +683,7 @@  static void mmhub_v2_0_get_clockgating(struct amdgpu_device *adev, u64 *flags)
 		/* There is no ATCL2 in MMHUB for 2.1.x. Keep the status
 		 * based on DAGB
 		 */
-		data |= MM_ATC_L2_MISC_CG__ENABLE_MASK;
+		data = MM_ATC_L2_MISC_CG__ENABLE_MASK;
 		data1 = RREG32_SOC15(MMHUB, 0, mmDAGB0_CNTL_MISC2_Sienna_Cichlid);
 		break;
 	default: