• Arnd Bergmann's avatar
    drm/amdgpu: fix error handling in df_v3_6_pmc_start · e1a2f2d2
    Arnd Bergmann authored
    When df_v3_6_pmc_get_ctrl_settings() fails for some reason, we
    store uninitialized data in a register, as gcc points out:
    
    drivers/gpu/drm/amd/amdgpu/df_v3_6.c: In function 'df_v3_6_pmc_start':
    drivers/gpu/drm/amd/amdgpu/amdgpu.h:1012:29: error: 'lo_val' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     #define WREG32_PCIE(reg, v) adev->pcie_wreg(adev, (reg), (v))
                                 ^~~~
    drivers/gpu/drm/amd/amdgpu/df_v3_6.c:334:39: note: 'lo_val' was declared here
      uint32_t lo_base_addr, hi_base_addr, lo_val, hi_val;
                                           ^~~~~~
    
    Make it return a proper error code that we can catch in the caller.
    
    Fixes: 992af942 ("drm/amdgpu: add df perfmon regs and funcs for xgmi")
    Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
    Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
    e1a2f2d2
df_v3_6.c 12.7 KB