“62c4f0a2d5a188f73a94f2cb8ea0dba3e7cf0a7f”上不存在“arch/mips/include/asm/string.h”
  • N
    drm/amdgpu: Ensure ret is always initialized when using SOC15_WAIT_ON_RREG · 59c8805d
    Nathan Chancellor 提交于
    [ Upstream commit a63141e31764f8daf3f29e8e2d450dcf9199d1c8 ]
    
    Commit b0f3cd3191cd ("drm/amdgpu: remove unnecessary JPEG2.0 code from
    VCN2.0") introduced a new clang warning in the vcn_v2_0_stop function:
    
    ../drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c:1082:2: warning: variable 'r'
    is used uninitialized whenever 'while' loop exits because its condition
    is false [-Wsometimes-uninitialized]
            SOC15_WAIT_ON_RREG(VCN, 0, mmUVD_STATUS, UVD_STATUS__IDLE, 0x7, r);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../drivers/gpu/drm/amd/amdgpu/../amdgpu/soc15_common.h:55:10: note:
    expanded from macro 'SOC15_WAIT_ON_RREG'
                    while ((tmp_ & (mask)) != (expected_value)) {   \
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c:1083:6: note: uninitialized use
    occurs here
            if (r)
                ^
    ../drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c:1082:2: note: remove the
    condition if it is always true
            SOC15_WAIT_ON_RREG(VCN, 0, mmUVD_STATUS, UVD_STATUS__IDLE, 0x7, r);
            ^
    ../drivers/gpu/drm/amd/amdgpu/../amdgpu/soc15_common.h:55:10: note:
    expanded from macro 'SOC15_WAIT_ON_RREG'
                    while ((tmp_ & (mask)) != (expected_value)) {   \
                           ^
    ../drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c:1072:7: note: initialize the
    variable 'r' to silence this warning
            int r;
                 ^
                  = 0
    1 warning generated.
    
    To prevent warnings like this from happening in the future, make the
    SOC15_WAIT_ON_RREG macro initialize its ret variable before the while
    loop that can time out. This macro's return value is always checked so
    it should set ret in both the success and fail path.
    
    Link: https://github.com/ClangBuiltLinux/linux/issues/776Signed-off-by: NNathan Chancellor <natechancellor@gmail.com>
    Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
    Signed-off-by: NSasha Levin <sashal@kernel.org>
    Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
    59c8805d
soc15_common.h 2.7 KB