drm/amdgpu: Add NULL check for asic_funcs

If driver load fails too early, asic_funcs pointer remains unassigned.
Add NULL check to sanitize unwind path.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Lijo Lazar 2025-07-18 09:25:21 +05:30 committed by Alex Deucher
parent 712d98c7da
commit 582bf7c515
1 changed files with 2 additions and 1 deletions

View File

@ -55,7 +55,8 @@ u64 amdgpu_nbio_get_pcie_replay_count(struct amdgpu_device *adev)
bool amdgpu_nbio_is_replay_cnt_supported(struct amdgpu_device *adev)
{
if (amdgpu_sriov_vf(adev) || !adev->asic_funcs->get_pcie_replay_count ||
if (amdgpu_sriov_vf(adev) || !adev->asic_funcs ||
!adev->asic_funcs->get_pcie_replay_count ||
(!adev->nbio.funcs || !adev->nbio.funcs->get_pcie_replay_count))
return false;