drm/amdgpu: Fix mc_umc_status used uninitialized warning
Subsystems (2)
PATCH 1/1 drm/amdgpu: Fix mc_umc_status used uninitialized warning
From: Leo Li <[email protected]>
On ChromeOS clang build, the following warning is seen:
/mnt/host/source/src/third_party/kernel/v5.15/drivers/gpu/drm/amd/amdgpu/umc_v6_7.c:463:6: error: variable 'mc_umc_status' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
if (mca_addr == UMC_INVALID_ADDR) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/mnt/host/source/src/third_party/kernel/v5.15/drivers/gpu/drm/amd/amdgpu/umc_v6_7.c:485:21: note: uninitialized use occurs here
if ((REG_GET_FIELD(mc_umc_status, MCA_UMC_UMC0_MCUMC_STATUST0, Val) == 1 &&
^~~~~~~~~~~~~
/mnt/host/source/src/third_party/kernel/v5.15/drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgpu.h:1208:5: note: expanded from macro 'REG_GET_FIELD'
(((value) & REG_FIELD_MASK(reg, field)) >> REG_FIELD_SHIFT(reg, field))
^~~~~
/mnt/host/source/src/third_party/kernel/v5.15/drivers/gpu/drm/amd/amdgpu/umc_v6_7.c:463:2: note: remove the 'if' if its condition is always true
if (mca_addr == UMC_INVALID_ADDR) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/mnt/host/source/src/third_party/kernel/v5.15/drivers/gpu/drm/amd/amdgpu/umc_v6_7.c:460:24: note: initialize the variable 'mc_umc_status' to silence this warning
uint64_t mc_umc_status, mc_umc_addrt0;
^
= 01 error generated.
make[5]: *** [/mnt/host/source/src/third_party/kernel/v5.15/scripts/Makefile.build:289: drivers/gpu/drm/amd/amdgpu/umc_v6_7.o] Error 1
Fix by initializing mc_umc_status = 0.
--- drivers/gpu/drm/amd/amdgpu/umc_v6_7.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/umc_v6_7.c +1 -1
@@ -457,7 +457,7 @@ static void umc_v6_7_query_error_address(struct amdgpu_device *adev, {uint32_t mc_umc_status_addr;uint32_t channel_index; -uint64_t mc_umc_status, mc_umc_addrt0; +uint64_t mc_umc_status =0 , mc_umc_addrt0;uint64_t err_addr, soc_pa, retired_page, column;if (mca_addr ==UMC_INVALID_ADDR ) {
Signature · 1 line
2.37.3
Quoted 20 lines · On 2022-09-28 10:49, [email protected] wrote:
From: Leo Li <[email protected]>
On ChromeOS clang build, the following warning is seen:
/mnt/host/source/src/third_party/kernel/v5.15/drivers/gpu/drm/amd/amdgpu/umc_v6_7.c:463:6: error: variable 'mc_umc_status' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]if (mca_addr == UMC_INVALID_ADDR) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /mnt/host/source/src/third_party/kernel/v5.15/drivers/gpu/drm/amd/amdgpu/umc_v6_7.c:485:21: note: uninitialized use occurs here if ((REG_GET_FIELD(mc_umc_status, MCA_UMC_UMC0_MCUMC_STATUST0, Val) == 1 && ^~~~~~~~~~~~~ /mnt/host/source/src/third_party/kernel/v5.15/drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgpu.h:1208:5: note: expanded from macro 'REG_GET_FIELD' (((value) & REG_FIELD_MASK(reg, field)) >> REG_FIELD_SHIFT(reg, field)) ^~~~~ /mnt/host/source/src/third_party/kernel/v5.15/drivers/gpu/drm/amd/amdgpu/umc_v6_7.c:463:2: note: remove the 'if' if its condition is always true if (mca_addr == UMC_INVALID_ADDR) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /mnt/host/source/src/third_party/kernel/v5.15/drivers/gpu/drm/amd/amdgpu/umc_v6_7.c:460:24: note: initialize the variable 'mc_umc_status' to silence this warning uint64_t mc_umc_status, mc_umc_addrt0; ^ = 0
Quoted 7 lines
1 error generated.
make[5]: *** [/mnt/host/source/src/third_party/kernel/v5.15/scripts/Makefile.build:289:drivers/gpu/drm/amd/amdgpu/umc_v6_7.o] Error 1Fix by initializing
mc_umc_status= 0.Fixes d8e19e32945e ("drm/amdgpu: support to convert dedicated umc mca address")Signed-off-by Leo Li <[email protected]>
Quoted 17 lines
--- drivers/gpu/drm/amd/amdgpu/umc_v6_7.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/umc_v6_7.c +1
-1@@ -457,7 +457,7 @@ static void umc_v6_7_query_error_address(struct amdgpu_device *adev, {uint32_t mc_umc_status_addr;uint32_t channel_index; -uint64_t mc_umc_status, mc_umc_addrt0; +uint64_t mc_umc_status =0 , mc_umc_addrt0;uint64_t err_addr, soc_pa, retired_page, column;if (mca_addr ==UMC_INVALID_ADDR ) {
Signature · 1 line
Hamza
Quoted 24 lines · Hamza Mahfooz
Quoted 23 lines · On 2022-09-28 10:49, [email protected] wrote:
From: Leo Li <[email protected]>
On ChromeOS clang build, the following warning is seen:
/mnt/host/source/src/third_party/kernel/v5.15/drivers/gpu/drm/amd/amdgpu/umc_v6_7.c:463:6: error: variable 'mc_umc_status' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized] if (mca_addr==UMC_INVALID_ADDR) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~/mnt/host/source/src/third_party/kernel/v5.15/drivers/gpu/drm/amd/amdgpu/umc_v6_7.c:485:21: note: uninitialized use occurs here
if ((REG_GET_FIELD(mc_umc_status, MCA_UMC_UMC0_MCUMC_STATUST0, Val)== 1 &&
^~~~~~~~~~~~~/mnt/host/source/src/third_party/kernel/v5.15/drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgpu.h:1208:5: note: expanded from macro 'REG_GET_FIELD'
(((value) ®_FIELD_MASK(reg, field)) >>REG_FIELD_SHIFT(reg, field))
^~~~~/mnt/host/source/src/third_party/kernel/v5.15/drivers/gpu/drm/amd/amdgpu/umc_v6_7.c:463:2: note: remove the 'if' if its condition is always true
if (mca_addr==UMC_INVALID_ADDR) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/mnt/host/source/src/third_party/kernel/v5.15/drivers/gpu/drm/amd/amdgpu/umc_v6_7.c:460:24: note: initialize the variable 'mc_umc_status' to silence this warning
uint64_tmc_umc_status,mc_umc_addrt0;
^
= 0
1 error generated.
make[5]: *** [/mnt/host/source/src/third_party/kernel/v5.15/scripts/Makefile.build:289:drivers/gpu/drm/amd/amdgpu/umc_v6_7.o] Error 1
Quoted 6 lines
Quoted 4 lines
Fix by initializing
mc_umc_status= 0.Fixes d8e19e32945e ("drm/amdgpu: support to convert dedicated umc mca address")Signed-off-by Leo Li <[email protected]>Reviewed-by Hamza Mahfooz <[email protected]>
Thanks! Will merge shortly.
Leo