Commit 6cbdf12b authored by Tom Rix's avatar Tom Rix Committed by Alex Deucher
Browse files

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: 5d64f9bb ("amdgpu/pm: Implement new API function "emit" that accepts buffer base and write offset")
Reviewed-by: default avatarEvan Quan <evan.quan@amd.com>
Signed-off-by: default avatarTom Rix <trix@redhat.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent b6fba4ec
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -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);