]> www.infradead.org Git - users/hch/misc.git/commitdiff
drm/amd/pm: use int type to store negative error codes
authorQianfeng Rong <rongqianfeng@vivo.com>
Thu, 4 Sep 2025 14:58:00 +0000 (22:58 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 5 Sep 2025 21:38:40 +0000 (17:38 -0400)
Use int instead of uint32_t for 'ret' variable to store negative error
codes or zero returned by other functions.

Storing the negative error codes in unsigned type, doesn't cause an issue
at runtime but can be confusing. Additionally, assigning negative error
codes to unsigned type may trigger a GCC warning when the -Wsign-conversion
flag is enabled.

No effect on runtime.

Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c
drivers/gpu/drm/amd/pm/powerplay/smumgr/smu7_smumgr.c
drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c

index 9a821563bc8e901c48e0edd1fa6c8feec55a0102..14ccd743ca1d0b1780b582aa5bf9c0648579bb5e 100644 (file)
@@ -1032,7 +1032,7 @@ static int smu10_print_clock_levels(struct pp_hwmgr *hwmgr,
                        data->clock_vol_info.vdd_dep_on_fclk;
        uint32_t i, now, size = 0;
        uint32_t min_freq, max_freq = 0;
-       uint32_t ret = 0;
+       int ret = 0;
 
        switch (type) {
        case PP_SCLK:
index baf51cd82a350fe7882bc6422f9fe5a1a928443c..0d4cbe4113a08ce864289f9f59f37a4f09d04488 100644 (file)
@@ -401,7 +401,7 @@ failed:
 int smu7_check_fw_load_finish(struct pp_hwmgr *hwmgr, uint32_t fw_type)
 {
        struct smu7_smumgr *smu_data = (struct smu7_smumgr *)(hwmgr->smu_backend);
-       uint32_t ret;
+       int ret;
 
        ret = phm_wait_on_indirect_register(hwmgr, mmSMC_IND_INDEX_11,
                                        smu_data->soft_regs_start + smum_get_offsetof(hwmgr,
index e97b0cf19197e9e51e29ac1b3d3e29606994a636..3baf20f4c373626e844d64975e1f0023411cf456 100644 (file)
@@ -470,7 +470,7 @@ static int renoir_od_edit_dpm_table(struct smu_context *smu,
 static int renoir_set_fine_grain_gfx_freq_parameters(struct smu_context *smu)
 {
        uint32_t min = 0, max = 0;
-       uint32_t ret = 0;
+       int ret = 0;
 
        ret = smu_cmn_send_smc_msg_with_param(smu,
                                                                SMU_MSG_GetMinGfxclkFrequency,