[cocci] [PATCH 03/36] drm/radeon: remove conditional return with no effect
Sang-Heon Jeon <[email protected]> Fri, 24 Jul 2026 03:45:05 +0900
| Newsgroups | fr.inria.cocci,org.freedesktop.lists.amd-gfx,org.freedesktop.lists.dri-devel,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
Both branches of the check return the same value, so the check has no effect. Remove it and return the value directly. This is the result of running the Coccinelle script from scripts/coccinelle/misc/cond_return_no_effect.cocci. Signed-off-by: Sang-Heon Jeon <[email protected]> --- drivers/gpu/drm/radeon/ci_dpm.c | 6 +----- drivers/gpu/drm/radeon/kv_dpm.c | 30 ++++++++++-------------------- drivers/gpu/drm/radeon/si_dpm.c | 14 ++------------ 3 files changed, 13 insertions(+), 37 deletions(-) diff --git a/drivers/gpu/drm/radeon/ci_dpm.c b/drivers/gpu/drm/radeon/ci_dpm.c index 703848fac189..11707f5aaa6b 100644 --- a/drivers/gpu/drm/radeon/ci_dpm.c +++ b/drivers/gpu/drm/radeon/ci_dpm.c @@ -5244,11 +5244,7 @@ static int ci_set_temperature_range(struct radeon_device *rdev) ret = ci_thermal_set_temperature_range(rdev, R600_TEMP_RANGE_MIN, R600_TEMP_RANGE_MAX); if (ret) return ret; - ret = ci_thermal_enable_alert(rdev, true); - if (ret) - return ret; - - return ret; + return ci_thermal_enable_alert(rdev, true); } int ci_dpm_late_enable(struct radeon_device *rdev) diff --git a/drivers/gpu/drm/radeon/kv_dpm.c b/drivers/gpu/drm/radeon/kv_dpm.c index 1693b36fc52d..fc5252ff2a26 100644 --- a/drivers/gpu/drm/radeon/kv_dpm.c +++ b/drivers/gpu/drm/radeon/kv_dpm.c @@ -843,16 +843,11 @@ static int kv_populate_samu_table(struct radeon_device *rdev) if (ret) return ret; - ret = kv_copy_bytes_to_smc(rdev, - pi->dpm_table_start + - offsetof(SMU7_Fusion_DpmTable, SamuLevel), - (u8 *)&pi->samu_level, - sizeof(SMU7_Fusion_ExtClkLevel) * SMU7_MAX_LEVELS_SAMU, - pi->sram_end); - if (ret) - return ret; - - return ret; + return kv_copy_bytes_to_smc(rdev, + pi->dpm_table_start + offsetof(SMU7_Fusion_DpmTable, SamuLevel), + (u8 *)&pi->samu_level, + sizeof(SMU7_Fusion_ExtClkLevel) * SMU7_MAX_LEVELS_SAMU, + pi->sram_end); } @@ -902,16 +897,11 @@ static int kv_populate_acp_table(struct radeon_device *rdev) if (ret) return ret; - ret = kv_copy_bytes_to_smc(rdev, - pi->dpm_table_start + - offsetof(SMU7_Fusion_DpmTable, AcpLevel), - (u8 *)&pi->acp_level, - sizeof(SMU7_Fusion_ExtClkLevel) * SMU7_MAX_LEVELS_ACP, - pi->sram_end); - if (ret) - return ret; - - return ret; + return kv_copy_bytes_to_smc(rdev, + pi->dpm_table_start + offsetof(SMU7_Fusion_DpmTable, AcpLevel), + (u8 *)&pi->acp_level, + sizeof(SMU7_Fusion_ExtClkLevel) * SMU7_MAX_LEVELS_ACP, + pi->sram_end); } static void kv_calculate_dfs_bypass_settings(struct radeon_device *rdev) diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c index 4b10715f951c..4323f86000ac 100644 --- a/drivers/gpu/drm/radeon/si_dpm.c +++ b/drivers/gpu/drm/radeon/si_dpm.c @@ -6418,22 +6418,12 @@ static int si_set_temperature_range(struct radeon_device *rdev) ret = si_thermal_set_temperature_range(rdev, R600_TEMP_RANGE_MIN, R600_TEMP_RANGE_MAX); if (ret) return ret; - ret = si_thermal_enable_alert(rdev, true); - if (ret) - return ret; - - return ret; + return si_thermal_enable_alert(rdev, true); } int si_dpm_late_enable(struct radeon_device *rdev) { - int ret; - - ret = si_set_temperature_range(rdev); - if (ret) - return ret; - - return ret; + return si_set_temperature_range(rdev); } void si_dpm_disable(struct radeon_device *rdev) -- 2.43.0