swsmu/amdgpu_smu: Fix the wrong if-condition
authorYu Songping <yusongping@huawei.com>
Thu, 24 Nov 2022 01:52:37 +0000 (09:52 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 29 Nov 2022 16:03:37 +0000 (11:03 -0500)
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>
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c

index 61eafaf..ca3beb5 100644 (file)
@@ -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);