Commit 81577503 authored by Lijo Lazar's avatar Lijo Lazar Committed by Alex Deucher

drm/amdgpu: Add NULL checks for function pointers

Check if function is implemented before making the call.
Signed-off-by: default avatarLijo Lazar <lijo.lazar@amd.com>
Reviewed-by: default avatarHawking Zhang <Hawking.Zhang@amd.com>
Acked-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 6fce23a4
...@@ -1423,8 +1423,10 @@ static void soc15_common_get_clockgating_state(void *handle, u64 *flags) ...@@ -1423,8 +1423,10 @@ static void soc15_common_get_clockgating_state(void *handle, u64 *flags)
if (amdgpu_sriov_vf(adev)) if (amdgpu_sriov_vf(adev))
*flags = 0; *flags = 0;
if (adev->nbio.funcs && adev->nbio.funcs->get_clockgating_state)
adev->nbio.funcs->get_clockgating_state(adev, flags); adev->nbio.funcs->get_clockgating_state(adev, flags);
if (adev->hdp.funcs && adev->hdp.funcs->get_clock_gating_state)
adev->hdp.funcs->get_clock_gating_state(adev, flags); adev->hdp.funcs->get_clock_gating_state(adev, flags);
if (amdgpu_ip_version(adev, MP0_HWIP, 0) != IP_VERSION(13, 0, 2)) { if (amdgpu_ip_version(adev, MP0_HWIP, 0) != IP_VERSION(13, 0, 2)) {
...@@ -1440,8 +1442,10 @@ static void soc15_common_get_clockgating_state(void *handle, u64 *flags) ...@@ -1440,8 +1442,10 @@ static void soc15_common_get_clockgating_state(void *handle, u64 *flags)
} }
/* AMD_CG_SUPPORT_ROM_MGCG */ /* AMD_CG_SUPPORT_ROM_MGCG */
if (adev->smuio.funcs && adev->smuio.funcs->get_clock_gating_state)
adev->smuio.funcs->get_clock_gating_state(adev, flags); adev->smuio.funcs->get_clock_gating_state(adev, flags);
if (adev->df.funcs && adev->df.funcs->get_clockgating_state)
adev->df.funcs->get_clockgating_state(adev, flags); adev->df.funcs->get_clockgating_state(adev, flags);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment