Skip to content

Commit

Permalink
swsmu/amdgpu_smu: Fix the wrong if-condition
Browse files Browse the repository at this point in the history
The logical operator '&&' will make
smu->ppt_funcs->set_gfx_power_up_by_imu segment fault when
smu->ppt_funcs is NULL.

Signed-off-by: Yu Songping <yusongping@huawei.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
  • Loading branch information
Yu Songping authored and Alex Deucher committed Nov 29, 2022
1 parent 5a2a19b commit 484d7dc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ int smu_get_dpm_freq_range(struct smu_context *smu,

int smu_set_gfx_power_up_by_imu(struct smu_context *smu)
{
if (!smu->ppt_funcs && !smu->ppt_funcs->set_gfx_power_up_by_imu)
if (!smu->ppt_funcs || !smu->ppt_funcs->set_gfx_power_up_by_imu)
return -EOPNOTSUPP;

return smu->ppt_funcs->set_gfx_power_up_by_imu(smu);
Expand Down

0 comments on commit 484d7dc

Please sign in to comment.