* [PATCH] swsmu/amdgpu_smu: Fix the wrong if-condition
@ 2022-11-24 1:52 Yu Songping
2022-11-24 10:10 ` Quan, Evan
0 siblings, 1 reply; 3+ messages in thread
From: Yu Songping @ 2022-11-24 1:52 UTC (permalink / raw)
To: airlied, daniel; +Cc: amd-gfx, dri-devel, linux-kernel
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>
---
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
index b880f4d7d67e..1cb728b0b7ee 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
@@ -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);
--
2.17.1
^ permalink raw reply [flat|nested] 3+ messages in thread* RE: [PATCH] swsmu/amdgpu_smu: Fix the wrong if-condition
2022-11-24 1:52 [PATCH] swsmu/amdgpu_smu: Fix the wrong if-condition Yu Songping
@ 2022-11-24 10:10 ` Quan, Evan
2022-11-25 2:23 ` Luben Tuikov
0 siblings, 1 reply; 3+ messages in thread
From: Quan, Evan @ 2022-11-24 10:10 UTC (permalink / raw)
To: Yu Songping, airlied, daniel; +Cc: dri-devel, amd-gfx, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1409 bytes --]
[AMD Official Use Only - General]
Reviewed-by: Evan Quan <evan.quan@amd.com>
> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Yu
> Songping
> Sent: Thursday, November 24, 2022 9:53 AM
> To: airlied@gmail.com; daniel@ffwll.ch
> Cc: dri-devel@lists.freedesktop.org; amd-gfx@lists.freedesktop.org; linux-
> kernel@vger.kernel.org
> Subject: [PATCH] swsmu/amdgpu_smu: Fix the wrong if-condition
>
> The logical operator '&&' will make
> smu->ppt_funcs->set_gfx_power_up_by_imu segment fault when
> ppt_funcs is
> smu->NULL.
>
> Signed-off-by: Yu Songping <yusongping@huawei.com>
> ---
> drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
> b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
> index b880f4d7d67e..1cb728b0b7ee 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
> @@ -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);
> --
> 2.17.1
[-- Attachment #2: winmail.dat --]
[-- Type: application/ms-tnef, Size: 15709 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] swsmu/amdgpu_smu: Fix the wrong if-condition
2022-11-24 10:10 ` Quan, Evan
@ 2022-11-25 2:23 ` Luben Tuikov
0 siblings, 0 replies; 3+ messages in thread
From: Luben Tuikov @ 2022-11-25 2:23 UTC (permalink / raw)
To: Quan, Evan, Yu Songping, airlied, daniel; +Cc: amd-gfx, dri-devel, linux-kernel
Applied!
Thanks,
Luben
On 2022-11-24 05:10, Quan, Evan wrote:
> [AMD Official Use Only - General]
>
> Reviewed-by: Evan Quan <evan.quan@amd.com>
>
>> -----Original Message-----
>> From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Yu
>> Songping
>> Sent: Thursday, November 24, 2022 9:53 AM
>> To: airlied@gmail.com; daniel@ffwll.ch
>> Cc: dri-devel@lists.freedesktop.org; amd-gfx@lists.freedesktop.org; linux-
>> kernel@vger.kernel.org
>> Subject: [PATCH] swsmu/amdgpu_smu: Fix the wrong if-condition
>>
>> The logical operator '&&' will make
>> smu->ppt_funcs->set_gfx_power_up_by_imu segment fault when
>> ppt_funcs is
>> smu->NULL.
>>
>> Signed-off-by: Yu Songping <yusongping@huawei.com>
>> ---
>> drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
>> b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
>> index b880f4d7d67e..1cb728b0b7ee 100644
>> --- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
>> +++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
>> @@ -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);
>> --
>> 2.17.1
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-11-25 2:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-24 1:52 [PATCH] swsmu/amdgpu_smu: Fix the wrong if-condition Yu Songping
2022-11-24 10:10 ` Quan, Evan
2022-11-25 2:23 ` Luben Tuikov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®