summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/pm
diff options
context:
space:
mode:
authorTom Rix <trix@redhat.com>2022-02-05 07:00:08 -0800
committerAlex Deucher <alexander.deucher@amd.com>2022-02-07 18:03:50 -0500
commit6cbdf12b87356827d35975dfb3030d116782737c (patch)
tree293eacee92453f1b34c2e7fc6e616d185ffeb73f /drivers/gpu/drm/amd/pm
parentb6fba4ecf3554c515aa5354c54dfdf70d7526ff1 (diff)
downloadlinux-6cbdf12b87356827d35975dfb3030d116782737c.tar.bz2
drm/amd/pm: fix error handling
clang static analysis reports this error amdgpu_smu.c:2289:9: warning: Called function pointer is null (null dereference) return smu->ppt_funcs->emit_clk_levels( ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ There is a logic error in the earlier check of emit_clk_levels. The error value is set to the ret variable but ret is never used. Return directly and remove the unneeded ret variable. Fixes: 5d64f9bbb628 ("amdgpu/pm: Implement new API function "emit" that accepts buffer base and write offset") Reviewed-by: Evan Quan <evan.quan@amd.com> Signed-off-by: Tom Rix <trix@redhat.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/pm')
-rw-r--r--drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
index 7925edc9e87b..e846231412bc 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
@@ -2279,7 +2279,6 @@ static int smu_emit_ppclk_levels(void *handle, enum pp_clock_type type, char *bu
{
struct smu_context *smu = handle;
enum smu_clk_type clk_type;
- int ret = 0;
clk_type = smu_convert_to_smuclk(type);
if (clk_type == SMU_CLK_COUNT)
@@ -2289,7 +2288,7 @@ static int smu_emit_ppclk_levels(void *handle, enum pp_clock_type type, char *bu
return -EOPNOTSUPP;
if (!smu->ppt_funcs->emit_clk_levels)
- ret = -ENOENT;
+ return -ENOENT;
return smu->ppt_funcs->emit_clk_levels(smu, clk_type, buf, offset);