drm/amdgpu: fix NULL pointer issue buffer funcs
Subsystems (2)
Alex Deucher
maintainerPATCH 1/3 drm/amdgpu: fix NULL pointer issue buffer funcs
From: Likun Gao <[email protected]>
If SDMA block not enabled, buffer_funcs will not initialize, fix the null pointer issue if buffer_funcs not initialized.
Signed-off-by Likun Gao <[email protected]>
Reviewed-by Hawking Zhang <[email protected]>
Signed-off-by Alex Deucher <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -1
@@ -3303,7 +3303,8 @@ static int amdgpu_device_ip_init(struct amdgpu_device *adev)if (r) goto init_failed; -if (adev->mman.buffer_funcs_ring->sched.ready) +if (adev->mman.buffer_funcs_ring && + adev->mman.buffer_funcs_ring->sched.ready)amdgpu_ttm_set_buffer_funcs_status (adev, true);/* Don't init kfd if whole hive need to be reset during init */
Signature · 1 line
2.51.0
Alex Deucher
maintainerPATCH 2/3 drm/amdgpu: fix DF NULL pointer issue for soc24
From: Likun Gao <[email protected]>
If DF function not initialized, NULL pointer issue will happen on soc24.
Signed-off-by Likun Gao <[email protected]>
Reviewed-by Hawking Zhang <[email protected]>
Signed-off-by Alex Deucher <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/soc24.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/soc24.c +1 -1
@@ -489,7 +489,7 @@ static int soc24_common_hw_init(struct amdgpu_ip_block *ip_block)if (adev->nbio.funcs->remap_hdp_registers) adev->nbio.funcs->remap_hdp_registers (adev); -if (adev->df.funcs->hw_init) +if (adev->df.funcs && adev->df.funcs->hw_init) adev->df.funcs->hw_init (adev);/* enable the doorbell aperture */
Signature · 1 line
2.51.0
Alex Deucher
maintainerPATCH 3/3 drm/amdgpu: fix NULL pointer issue for supports_baco
In reply to Alex DeucherFrom: Likun Gao <[email protected]>
Return 0 if the realted ASIC do not have supports_baco function to fix the NULL pointer issue.
Signed-off-by Likun Gao <[email protected]>
Reviewed-by Le Ma <[email protected]>
Signed-off-by Alex Deucher <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +2 -1
@@ -1544,7 +1544,8 @@ int emu_soc_asic_init(struct amdgpu_device *adev);#define amdgpu_asic_get_pcie_usage (adev, cnt0, cnt1) ((adev)->asic_funcs->get_pcie_usage((adev), (cnt0), (cnt1)))#define amdgpu_asic_need_reset_on_init (adev) (adev)->asic_funcs->need_reset_on_init((adev))#define amdgpu_asic_get_pcie_replay_count (adev) ((adev)->asic_funcs->get_pcie_replay_count((adev))) -#define amdgpu_asic_supports_baco (adev) (adev)->asic_funcs->supports_baco((adev)) +#define amdgpu_asic_supports_baco (adev) \ + ((adev)->asic_funcs->supports_baco ? (adev)->asic_funcs->supports_baco((adev)) : 0)#define amdgpu_asic_pre_asic_init (adev) (adev)->asic_funcs->pre_asic_init((adev))#define amdgpu_asic_update_umd_stable_pstate (adev, enter) \ ((adev)->asic_funcs->update_umd_stable_pstate ? (adev)->asic_funcs->update_umd_stable_pstate((adev), (enter)) : 0)
Signature · 1 line
2.51.0