]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/amd/pm: fix warning reported by kernel test robot
authorXiaomeng Hou <Xiaomeng.Hou@amd.com>
Mon, 7 Jun 2021 08:36:41 +0000 (16:36 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 8 Jun 2021 16:14:29 +0000 (12:14 -0400)
Kernel test robot throws warning ->

>> drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu13/yellow_carp_ppt.c:483:2:
   warning: variable 'member_type' is used uninitialized whenever switch
   default is taken [-Wsometimes-uninitialized]
       default:
       ^~~~~~~
   drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu13/yellow_carp_ppt.c:487:47:
   note: uninitialized use occurs here
       return yellow_carp_get_smu_metrics_data(smu, member_type, value);
                               ^~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu13/yellow_carp_ppt.c:465:2:
   note: variable 'member_type' is declared here
       MetricsMember_t member_type;
       ^
   1 warning generated.

Fix this warning by return errno when the clk type is unsupported.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Xiaomeng Hou <Xiaomeng.Hou@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c

index 031c49fb4582e6ad911e325f468402bb4aedf959..0cd7902d51725791819882ae7844f4e200312f75 100644 (file)
@@ -728,7 +728,7 @@ static int yellow_carp_get_current_clk_freq(struct smu_context *smu,
                return smu_cmn_send_smc_msg_with_param(smu,
                                SMU_MSG_GetFclkFrequency, 0, value);
        default:
-               break;
+               return -EINVAL;
        }
 
        return yellow_carp_get_smu_metrics_data(smu, member_type, value);