Since the "smu->ppt_funcs" was already well installed at early_init phase, the checks afterwards make nonsense. Signed-off-by: Evan Quan <evan.quan@xxxxxxx> Change-Id: I07a945035a87b23032e4911bba768edacbd5e65a --- drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 20 +++++++++----------- drivers/gpu/drm/amd/pm/swsmu/smu_internal.h | 2 +- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c index 27a453fb4db7..3773e95a18bf 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c @@ -934,7 +934,7 @@ static void smu_interrupt_work_fn(struct work_struct *work) struct smu_context *smu = container_of(work, struct smu_context, interrupt_work); - if (smu->ppt_funcs && smu->ppt_funcs->interrupt_work) + if (smu->ppt_funcs->interrupt_work) smu->ppt_funcs->interrupt_work(smu); } @@ -1782,7 +1782,7 @@ static int smu_force_smuclk_levels(struct smu_context *smu, return -EINVAL; } - if (smu->ppt_funcs && smu->ppt_funcs->force_clk_levels) { + if (smu->ppt_funcs->force_clk_levels) { ret = smu->ppt_funcs->force_clk_levels(smu, clk_type, mask); if (!ret && !(smu->user_dpm_profile.flags & SMU_DPM_USER_PROFILE_RESTORE)) { smu->user_dpm_profile.clk_mask[clk_type] = mask; @@ -1845,8 +1845,7 @@ static int smu_set_mp1_state(void *handle, struct smu_context *smu = handle; int ret = 0; - if (smu->ppt_funcs && - smu->ppt_funcs->set_mp1_state) + if (smu->ppt_funcs->set_mp1_state) ret = smu->ppt_funcs->set_mp1_state(smu, mp1_state); return ret; @@ -1858,7 +1857,7 @@ static int smu_set_df_cstate(void *handle, struct smu_context *smu = handle; int ret = 0; - if (!smu->ppt_funcs || !smu->ppt_funcs->set_df_cstate) + if (!smu->ppt_funcs->set_df_cstate) return 0; ret = smu->ppt_funcs->set_df_cstate(smu, state); @@ -1872,7 +1871,7 @@ int smu_allow_xgmi_power_down(struct smu_context *smu, bool en) { int ret = 0; - if (!smu->ppt_funcs || !smu->ppt_funcs->allow_xgmi_power_down) + if (!smu->ppt_funcs->allow_xgmi_power_down) return 0; ret = smu->ppt_funcs->allow_xgmi_power_down(smu, en); @@ -2510,7 +2509,7 @@ static int smu_get_baco_capability(void *handle, bool *cap) *cap = false; - if (smu->ppt_funcs && smu->ppt_funcs->baco_is_support) + if (smu->ppt_funcs->baco_is_support) *cap = smu->ppt_funcs->baco_is_support(smu); return 0; @@ -2542,7 +2541,7 @@ bool smu_mode1_reset_is_support(struct smu_context *smu) { bool ret = false; - if (smu->ppt_funcs && smu->ppt_funcs->mode1_reset_is_support) + if (smu->ppt_funcs->mode1_reset_is_support) ret = smu->ppt_funcs->mode1_reset_is_support(smu); return ret; @@ -2667,8 +2666,7 @@ int smu_get_ecc_info(struct smu_context *smu, void *umc_ecc) { int ret = -EOPNOTSUPP; - if (smu->ppt_funcs && - smu->ppt_funcs->get_ecc_info) + if (smu->ppt_funcs->get_ecc_info) ret = smu->ppt_funcs->get_ecc_info(smu, umc_ecc); return ret; @@ -2881,7 +2879,7 @@ int smu_send_hbm_bad_pages_num(struct smu_context *smu, uint32_t size) { int ret = 0; - if (smu->ppt_funcs && smu->ppt_funcs->send_hbm_bad_pages_num) + if (smu->ppt_funcs->send_hbm_bad_pages_num) ret = smu->ppt_funcs->send_hbm_bad_pages_num(smu, size); return ret; diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu_internal.h b/drivers/gpu/drm/amd/pm/swsmu/smu_internal.h index 5f21ead860f9..a91967b31eeb 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/smu_internal.h +++ b/drivers/gpu/drm/amd/pm/swsmu/smu_internal.h @@ -28,7 +28,7 @@ #if defined(SWSMU_CODE_LAYER_L1) #define smu_ppt_funcs(intf, ret, smu, args...) \ - ((smu)->ppt_funcs ? ((smu)->ppt_funcs->intf ? (smu)->ppt_funcs->intf(smu, ##args) : ret) : -EINVAL) + ((smu)->ppt_funcs->intf ? (smu)->ppt_funcs->intf(smu, ##args) : ret) #define smu_init_microcode(smu) smu_ppt_funcs(init_microcode, 0, smu) #define smu_fini_microcode(smu) smu_ppt_funcs(fini_microcode, 0, smu) -- 2.29.0