Skip to contentSkip to conversation

drm/amdgpu: Fix uninitialized warning in mmhub_v2_0_get_clockgating()

PATCH Applied Nathan Chancellor 2 participants 2 messages Oct 24, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: Fix uninitialized warning in mmhub_v2_0_get_clockgating()

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")
---
 drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c +1 -1
index 5ec6d17fed09..998b5d17b271 100644
@@ -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

Signature · 1 line
2.38.1
Applied
#1 lore raw

Applied. Thanks!

Alex

Quoted 40 lines · Nathan Chancellor

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")
---
 drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c +1 -1
index 5ec6d17fed09..998b5d17b271 100644
@@ -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