drm/amd/pm: return -ENOTSUPP if there is no get_dpm_ultimate_freq function
Subsystems (3)
PATCH v2 1/1 drm/amd/pm: return -ENOTSUPP if there is no get_dpm_ultimate_freq function
From: Tom Rix <[email protected]>
clang static analysis reports this represenative problem amdgpu_smu.c:144:18: warning: The left operand of '*' is a garbage value
return clk_freq * 100;
~~~~~~~~ ^If there is no get_dpm_ultimate_freq function, smu_get_dpm_freq_range returns success without setting the output min,max parameters. So return an -ENOTSUPP error.
---
v2: return error instead of initializing min/max
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +1 -1
@@ -116,7 +116,7 @@ int smu_get_dpm_freq_range(struct smu_context *smu,uint32_t *min, uint32_t *max) { - int ret = 0; + int ret = -ENOTSUPP;if (!min && !max)return -EINVAL ;
Signature · 1 line
2.26.3
Alex Deucher
AppliedApplied. Thanks!
Alex
Quoted 36 lines · On Mon, Jan 24, 2022 at 3:18 PM <[email protected]> wrote:
From: Tom Rix <[email protected]>
clang static analysis reports this represenative problem amdgpu_smu.c:144:18: warning: The left operand of '*' is a garbage value
return clk_freq * 100; ~~~~~~~~ ^If there is no
get_dpm_ultimate_freqfunction,smu_get_dpm_freq_rangereturns success without setting the output min,max parameters. So return an-ENOTSUPPerror.Fixes e5ef784b1e17 ("drm/amd/powerplay: revise calling chain on retrieving frequency range")Signed-off-by Tom Rix <[email protected]>---
v2: return error instead of initializing min/max
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +1
-2@@ -116,7 +116,7 @@ int smu_get_dpm_freq_range(struct smu_context *smu,uint32_t *min, uint32_t *max) { - int ret = 0; + int ret = -ENOTSUPP;if (!min && !max)return -EINVAL ; --2.26.3