Commit 42993bcf authored by Asad Kamal's avatar Asad Kamal Committed by Alex Deucher
Browse files

drm/amd/pm: Add NULL check for power limit



Add NULL check for smu power limit pointer

v2: Update error code on failure (Lijo)

Signed-off-by: default avatarAsad Kamal <asad.kamal@amd.com>
Reviewed-by: default avatarLijo Lazar <lijo.lazar@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent e8483594
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -2907,6 +2907,9 @@ int smu_get_power_limit(void *handle,
	if (!smu->pm_enabled || !smu->adev->pm.dpm_enabled)
		return -EOPNOTSUPP;

	if  (!limit)
		return -EINVAL;

	switch (pp_power_type) {
	case PP_PWR_TYPE_SUSTAINED:
		limit_type = SMU_DEFAULT_PPT_LIMIT;