diff options
author | Hawking Zhang <Hawking.Zhang@amd.com> | 2024-01-22 17:38:23 +0800 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2024-01-25 15:45:11 -0500 |
commit | bc8f6d42b1334f486980d57c8d12f3128d30c2e3 (patch) | |
tree | 9fa0d4f57db03935ce2452b11b74b6272cab69db /drivers/gpu | |
parent | 89a7c0bd74918f723c94c10452265e25063cba9b (diff) | |
download | linux-stable-bc8f6d42b1334f486980d57c8d12f3128d30c2e3.tar.gz linux-stable-bc8f6d42b1334f486980d57c8d12f3128d30c2e3.tar.bz2 linux-stable-bc8f6d42b1334f486980d57c8d12f3128d30c2e3.zip |
drm/amdgpu: Fix null pointer dereference
amdgpu_reg_state_sysfs_fini could be invoked at the
time when asic_func is even not initialized, i.e.,
amdgpu_discovery_init fails for some reason.
Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/amd/include/amdgpu_reg_state.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/include/amdgpu_reg_state.h b/drivers/gpu/drm/amd/include/amdgpu_reg_state.h index be519c8edf49..335980e2afbf 100644 --- a/drivers/gpu/drm/amd/include/amdgpu_reg_state.h +++ b/drivers/gpu/drm/amd/include/amdgpu_reg_state.h @@ -138,7 +138,7 @@ static inline size_t amdgpu_reginst_size(uint16_t num_inst, size_t inst_size, } #define amdgpu_asic_get_reg_state_supported(adev) \ - ((adev)->asic_funcs->get_reg_state ? 1 : 0) + (((adev)->asic_funcs && (adev)->asic_funcs->get_reg_state) ? 1 : 0) #define amdgpu_asic_get_reg_state(adev, state, buf, size) \ ((adev)->asic_funcs->get_reg_state ? \ |