summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2024-01-22 03:05:56 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2024-01-22 03:05:56 +0000
commitc2ba4bfd6473de1532b98b37d1e53bee9d28861a (patch)
tree32fd4b82feff27641128cdb5778fabb31e7db1ef
parent71178d8c60f6a693be5d20330a2a657fadf1f50a (diff)
drm/amdgpu: Add NULL checks for function pointers
From Lijo Lazar fb26de4a86e19711880e7e845505505f01d2eb82 in linux-6.6.y/6.6.13 81577503efb49f4ad76af22f9941d72900ef4aab in mainline linux
-rw-r--r--sys/dev/pci/drm/amd/amdgpu/soc15.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/sys/dev/pci/drm/amd/amdgpu/soc15.c b/sys/dev/pci/drm/amd/amdgpu/soc15.c
index f1b8c925d2a..3a152a76d36 100644
--- a/sys/dev/pci/drm/amd/amdgpu/soc15.c
+++ b/sys/dev/pci/drm/amd/amdgpu/soc15.c
@@ -1422,9 +1422,11 @@ static void soc15_common_get_clockgating_state(void *handle, u64 *flags)
if (amdgpu_sriov_vf(adev))
*flags = 0;
- adev->nbio.funcs->get_clockgating_state(adev, flags);
+ if (adev->nbio.funcs && adev->nbio.funcs->get_clockgating_state)
+ adev->nbio.funcs->get_clockgating_state(adev, flags);
- adev->hdp.funcs->get_clock_gating_state(adev, flags);
+ if (adev->hdp.funcs && adev->hdp.funcs->get_clock_gating_state)
+ adev->hdp.funcs->get_clock_gating_state(adev, flags);
if (adev->ip_versions[MP0_HWIP][0] != IP_VERSION(13, 0, 2)) {
@@ -1440,9 +1442,11 @@ static void soc15_common_get_clockgating_state(void *handle, u64 *flags)
}
/* AMD_CG_SUPPORT_ROM_MGCG */
- adev->smuio.funcs->get_clock_gating_state(adev, flags);
+ if (adev->smuio.funcs && adev->smuio.funcs->get_clock_gating_state)
+ adev->smuio.funcs->get_clock_gating_state(adev, flags);
- adev->df.funcs->get_clockgating_state(adev, flags);
+ if (adev->df.funcs && adev->df.funcs->get_clockgating_state)
+ adev->df.funcs->get_clockgating_state(adev, flags);
}
static int soc15_common_set_powergating_state(void *handle,