Skip to contentSkip to conversation

drm/amd/pm/smu7: Remove non-functional SMU7 voltage dependency on DAL

bug report Dan Carpenter 1 participant 1 message Apr 13

lore
Share & tools
lore
#0 lore raw

Hello Timur Kristóf,

Commit 9f49e3d4cb86 ("drm/amd/pm/smu7: Remove non-functional SMU7 voltage dependency on DAL") from Mar 29, 2026 (linux-next), leads to the following Smatch static checker warning:

	drivers/gpu/drm/amd/amdgpu/../pm/powerplay/hwmgr/smu7_hwmgr.c:3065 smu7_hwmgr_backend_init()
	warn: duplicate zero check 'result' (previous on line 3054)

drivers/gpu/drm/amd/amdgpu/../pm/powerplay/hwmgr/smu7_hwmgr.c

    3024 static int smu7_hwmgr_backend_init(struct pp_hwmgr *hwmgr)
    3025 {
    3026         struct amdgpu_device *adev = hwmgr->adev;
    3027         struct smu7_hwmgr *data;
    3028         int result = 0;
    3029 
    3030         data = kzalloc_obj(struct smu7_hwmgr);
    3031         if (data == NULL)
    3032                 return -ENOMEM;
    3033 
    3034         hwmgr->backend = data;
    3035         smu7_set_sclk_cap(hwmgr);
    3036         smu7_patch_voltage_workaround(hwmgr);
    3037         smu7_init_dpm_defaults(hwmgr);
    3038 
    3039         /* Get leakage voltage based on leakage ID. */
    3040         if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps,
    3041                         PHM_PlatformCaps_EVV)) {
    3042                 result = smu7_get_evv_voltages(hwmgr);
    3043                 if (result) {
    3044                         pr_info("Get EVV Voltage Failed.  Abort Driver loading!\n");
    3045                         kfree(hwmgr->backend);
    3046                         hwmgr->backend = NULL;
    3047                         return -EINVAL;
    3048                 }
    3049         } else {
    3050                 smu7_get_elb_voltages(hwmgr);
    3051         }
    3052 
    3053         result = smu7_init_voltage_dependency_on_display_clock_table(hwmgr);
    3054         if (result)
    3055                 goto fail;
    3056 
    3057         if (hwmgr->pp_table_version == PP_TABLE_V1) {
    3058                 smu7_complete_dependency_tables(hwmgr);
    3059                 smu7_set_private_data_based_on_pptable_v1(hwmgr);
    3060         } else if (hwmgr->pp_table_version == PP_TABLE_V0) {
    3061                 smu7_patch_dependency_tables_with_leakage(hwmgr);
    3062                 smu7_set_private_data_based_on_pptable_v0(hwmgr);
    3063         }
    3064 
--> 3065         if (result)
    3066                 goto fail;

The commit deleted the function call but left the error checking.

    3067 
    3068         data->is_tlu_enabled = false;
    3069 
    3070         hwmgr->platform_descriptor.hardwareActivityPerformanceLevels =
    3071                                                         SMU7_MAX_HARDWARE_POWERLEVELS;
    3072         hwmgr->platform_descriptor.hardwarePerformanceLevels = 2;
    3073         hwmgr->platform_descriptor.minimumClocksReductionPercentage = 50;
    3074 
    3075         data->pcie_gen_cap = adev->pm.pcie_gen_mask;
    3076         if (data->pcie_gen_cap & CAIL_PCIE_LINK_SPEED_SUPPORT_GEN3)
    3077                 data->pcie_spc_cap = 20;
    3078         else
    3079                 data->pcie_spc_cap = 16;
    3080         data->pcie_lane_cap = adev->pm.pcie_mlw_mask;
    3081 
    3082         hwmgr->platform_descriptor.vbiosInterruptId = 0x20000400; /* IRQ_SOURCE1_SW_INT */
    3083         /* The true clock step depends on the frequency, typically 4.5 or 9 MHz. Here we use 5. */
    3084         hwmgr->platform_descriptor.clockStep.engineClock = 500;
    3085         hwmgr->platform_descriptor.clockStep.memoryClock = 500;
    3086         smu7_thermal_parameter_init(hwmgr);
    3087 
    3088         result = smu7_update_edc_leakage_table(hwmgr);
    3089         if (result)
    3090                 goto fail;
    3091 
    3092         return 0;
    3093 fail:
    3094         smu7_hwmgr_backend_fini(hwmgr);
    3095         return result;
    3096 }

This email is a free service from the Smatch-CI project [smatch.sf.net].

regards,
dan carpenter