From: Asad Kamal Date: Thu, 6 Nov 2025 15:47:29 +0000 (+0800) Subject: drm/amd/pm: Add NULL check for power limit X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=42993bcf1c8d773d783a613d2d4e9172c16b4926;p=thirdparty%2Fkernel%2Flinux.git 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: Asad Kamal Reviewed-by: Lijo Lazar Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c index c0e7c45ac0e61..14351ec707016 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c @@ -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;