diff options
author | Jiawei Gu <Jiawei.Gu@amd.com> | 2020-12-23 13:54:57 +0800 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2021-01-05 11:32:30 -0500 |
commit | 35c3c89a859257833333396c458b5b087a5b8ed3 (patch) | |
tree | a39306c67883e18e075c9291c9c660ee6ba840f2 /drivers | |
parent | a11d9ff3ebe05d6c9412eaa06a7398e3729749ff (diff) | |
download | linux-stable-35c3c89a859257833333396c458b5b087a5b8ed3.tar.gz linux-stable-35c3c89a859257833333396c458b5b087a5b8ed3.tar.bz2 linux-stable-35c3c89a859257833333396c458b5b087a5b8ed3.zip |
drm/amdgpu: fix potential NULL pointer when check_atom_bios() fails
Asic funcs pointer needs being checked whether is NULL. Because when
check_atom_bios() fails in req_init_data handshake, asic funcs pointer
is not initialized yet.
Signed-off-by: Jiawei Gu <Jiawei.Gu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c index 6333cada1e09..efdf639f6593 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c @@ -155,7 +155,7 @@ static bool amdgpu_read_bios_from_rom(struct amdgpu_device *adev) u8 header[AMD_VBIOS_SIGNATURE_END+1] = {0}; int len; - if (!adev->asic_funcs->read_bios_from_rom) + if (!adev->asic_funcs || !adev->asic_funcs->read_bios_from_rom) return false; /* validate VBIOS signature */ @@ -348,7 +348,8 @@ static bool amdgpu_read_disabled_bios(struct amdgpu_device *adev) if (adev->flags & AMD_IS_APU) return igp_read_bios_from_vram(adev); else - return amdgpu_asic_read_disabled_bios(adev); + return (!adev->asic_funcs || !adev->asic_funcs->read_disabled_bios) ? + false : amdgpu_asic_read_disabled_bios(adev); } #ifdef CONFIG_ACPI |