drm/amd/pm: Add NULL check for power limit
Subsystems (3)
PATCH v2 1/1 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 <[email protected]>
--- drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +3 -0
@@ -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 ;
Signature · 1 line
2.46.0
Quoted 14 lines · Asad Kamal
Add NULL check for smu power limit pointer
v2: Update error code on failure (Lijo)
Signed-off-by Asad Kamal <[email protected]>--- drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 3 +++ 1 file changed, 3 insertions(+)drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0
-0
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c int smu_get_power_limit(void *handle, · line 2912
Quoted 6 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +3
-0@@ -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 ; +
Reviewed-by Lijo Lazar <[email protected]>
Thanks,
Lijo
Quoted 3 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0
-0switch (pp_power_type) {case PP_PWR_TYPE_SUSTAINED : limit_type =SMU_DEFAULT_PPT_LIMIT ;