drm/amdgpu: Ignored various return code
Subsystems (3)
PATCH v5 1/1 drm/amdgpu: Ignored various return code
The return code of a non void function should not be ignored. In cases where we do not care, the code needs to suppress it.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 8 +++----- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 8 ++++++-- 2 files changed, 9 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +3 -5
@@ -312,8 +312,7 @@ int amdgpu_amdkfd_post_reset(struct amdgpu_device *adev)void amdgpu_amdkfd_gpu_reset (struct amdgpu_device *adev) {if (amdgpu_device_should_recover_gpu (adev)) -amdgpu_reset_domain_schedule (adev->reset_domain, - &adev->kfd.reset_work); + (void )amdgpu_reset_domain_schedule (adev->reset_domain, &adev->kfd.reset_work); } int amdgpu_amdkfd_alloc_gtt_mem(struct amdgpu_device *adev, size_t size,
@@ -714,9 +713,8 @@ void amdgpu_amdkfd_set_compute_idle(struct amdgpu_device *adev, bool idle)if (gfx_block !=NULL ) gfx_block->version->funcs->set_powergating_state ((void *)gfx_block, state); } -amdgpu_dpm_switch_power_profile (adev, -PP_SMC_POWER_PROFILE_COMPUTE , - !idle); + (void )amdgpu_dpm_switch_power_profile (adev,PP_SMC_POWER_PROFILE_COMPUTE , !idle); + }bool amdgpu_amdkfd_is_kfd_vmid (struct amdgpu_device *adev,u32 vmid)
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +6 -2
@@ -2796,8 +2796,12 @@ static int runtime_enable(struct kfd_process *p, uint64_t r_debug,* SET_SHADER_DEBUGGER clears any stale process context data * saved in MES. */ -if (pdd->dev->kfd->shared_resources.enable_mes) -kfd_dbg_set_mes_debug_mode (pdd, !kfd_dbg_has_cwsr_workaround (pdd->dev)); +if (pdd->dev->kfd->shared_resources.enable_mes) { + ret =kfd_dbg_set_mes_debug_mode ( + pdd, !kfd_dbg_has_cwsr_workaround (pdd->dev)); +if (ret) +return ret; + } } p->runtime_info.runtime_state =DEBUG_RUNTIME_STATE_ENABLED ;
Signature · 1 line
2.43.0
[Public]
Can we try to keep it to <80 characters?
Kent
Quoted 73 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Andrew Martin
Sent: Wednesday, December 3, 2025 9:45 AM
To: [email protected]
Cc: Martin, Andrew <[email protected]>
Subject: [PATCH v5] drm/amdgpu: Ignored various return codeThe return code of a non void function should not be ignored. In cases where we do not care, the code needs to suppress it.
Signed-off-by Andrew Martin <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 8 +++----- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 8 ++++++-- 2 files changed, 9 insertions(+), 7 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +1
-2@@ -312,8 +312,7 @@ int amdgpu_amdkfd_post_reset(struct amdgpu_device *adev)void amdgpu_amdkfd_gpu_reset (struct amdgpu_device *adev) {if (amdgpu_device_should_recover_gpu (adev)) -amdgpu_reset_domain_schedule (adev->reset_domain, - &adev->kfd.reset_work); + (void )amdgpu_reset_domain_schedule (adev->reset_domain, &adev- >kfd.reset_work); }int amdgpu_amdkfd_alloc_gtt_mem(struct
amdgpu_device*adev,size_tsize,drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +2
-3@@ -714,9 +713,8 @@ void amdgpu_amdkfd_set_compute_idle(struct amdgpu_device *adev, bool idle) if (gfx_block != NULL) gfx_block->version->funcs->set_powergating_state((void *)gfx_block, state); } -amdgpu_dpm_switch_power_profile (adev, -PP_SMC_POWER_PROFILE_COMPUTE , - !idle); + (void)amdgpu_dpm_switch_power_profile(adev, PP_SMC_POWER_PROFILE_COMPUTE, !idle); +}
bool
amdgpu_amdkfd_is_kfd_vmid(struct amdgpu_device *adev, u32 vmid)drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +6
-2@@ -2796,8 +2796,12 @@ static int runtime_enable(struct kfd_process *p, uint64_tr_debug, * SET_SHADER_DEBUGGER clears any stale process context data * saved in MES. */ -if (pdd->dev->kfd->shared_resources.enable_mes) -kfd_dbg_set_mes_debug_mode (pdd, !kfd_dbg_has_cwsr_workaround(pdd->dev)); +if (pdd->dev->kfd->shared_resources.enable_mes) { + ret =kfd_dbg_set_mes_debug_mode ( + pdd, !kfd_dbg_has_cwsr_workaround (pdd->dev)); +if (ret) +return ret; + } }p->runtime_info.runtime_state = DEBUG_RUNTIME_STATE_ENABLED;--
2.43.0
[Public]
Greetings Kent
Quoted 3 lines
Can we try to keep it to <80 characters?
Kent
Yes I do try but, sometimes this collide with concept of keeping to the exiting code style (though not in this case). Besides the *checkpatch.pl* has extended the *max_line_length* to 100. And indeed running it: * ./scripts/checkpatch.pl -g HEAD* did not warn or erred.
[Public]
Fair enough, I saw the 2-lines-down-to-1 and immediately thought about length. Unless anyone really complains then we can use use 100chars, per checkpatch. Thanks for clarifying
Kent
Quoted 19 lines
-----Original Message-----
From: Martin, Andrew <[email protected]>
Sent: Wednesday, December 3, 2025 1:12 PM
To: Russell, Kent <[email protected]>; [email protected]
Subject: RE: [PATCH v5] drm/amdgpu: Ignored various return code[Public]
Greetings Kent
Quoted 3 lines
Can we try to keep it to <80 characters?
Kent
Yes I do try but, sometimes this collide with concept of keeping to the exiting code style (though not in this case). Besides the *checkpatch.pl* has extended the *max_line_length* to 100. And indeed running it: *
./scripts/checkpatch.pl-g HEAD* did not warn or erred.
Quoted 4 lines · Andrew Martin
The return code of a non void function should not be ignored. In cases where we do not care, the code needs to suppress it.
Signed-off-by Andrew Martin <[email protected]>
Quoted 50 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 8 +++----- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 8 ++++++-- 2 files changed, 9 insertions(+), 7 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +3
-5@@ -312,8 +312,7 @@ int amdgpu_amdkfd_post_reset(struct amdgpu_device *adev)void amdgpu_amdkfd_gpu_reset (struct amdgpu_device *adev) {if (amdgpu_device_should_recover_gpu (adev)) -amdgpu_reset_domain_schedule (adev->reset_domain, - &adev->kfd.reset_work); + (void )amdgpu_reset_domain_schedule (adev->reset_domain, &adev->kfd.reset_work); } int amdgpu_amdkfd_alloc_gtt_mem(struct amdgpu_device *adev, size_t size,@@ -714,9 +713,8 @@ void amdgpu_amdkfd_set_compute_idle(struct amdgpu_device *adev, bool idle)if (gfx_block !=NULL ) gfx_block->version->funcs->set_powergating_state ((void *)gfx_block, state); } -amdgpu_dpm_switch_power_profile (adev, -PP_SMC_POWER_PROFILE_COMPUTE , - !idle); + (void )amdgpu_dpm_switch_power_profile (adev,PP_SMC_POWER_PROFILE_COMPUTE , !idle); + }bool amdgpu_amdkfd_is_kfd_vmid (struct amdgpu_device *adev,u32 vmid)drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +6
-2@@ -2796,8 +2796,12 @@ static int runtime_enable(struct kfd_process *p, uint64_t r_debug,* SET_SHADER_DEBUGGER clears any stale process context data * saved in MES. */ -if (pdd->dev->kfd->shared_resources.enable_mes) -kfd_dbg_set_mes_debug_mode (pdd, !kfd_dbg_has_cwsr_workaround (pdd->dev)); +if (pdd->dev->kfd->shared_resources.enable_mes) { + ret =kfd_dbg_set_mes_debug_mode ( + pdd, !kfd_dbg_has_cwsr_workaround (pdd->dev)); +if (ret) +return ret; + } } p->runtime_info.runtime_state =DEBUG_RUNTIME_STATE_ENABLED ;
[AMD Official Use Only - AMD Internal Distribution Only]
Greetings
Thanks, finally!
One love!
Quoted 76 lines
-----Original Message-----
From: Kuehling, Felix <[email protected]>
Sent: Friday, December 5, 2025 11:36 AM
To: Martin, Andrew <[email protected]>; [email protected]
Subject: Re: [PATCH v5] drm/amdgpu: Ignored various return codeQuoted 4 lines · Andrew Martin
The return code of a non void function should not be ignored. In cases where we do not care, the code needs to suppress it.
Signed-off-by Andrew Martin <[email protected]>Reviewed-by Felix Kuehling <[email protected]>drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c int amdgpu_amdkfd_post_reset(struct amdgpu_device
Quoted 11 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 8 +++----- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 8 ++++++-- 2 files changed, 9 insertions(+), 7 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +0
-0@@ -312,8 +312,7 @@ int amdgpu_amdkfd_post_reset(struct amdgpu_device*adev)
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +2
-2void amdgpu_amdkfd_gpu_reset (struct amdgpu_device *adev) {if (amdgpu_device_should_recover_gpu (adev)) -amdgpu_reset_domain_schedule (adev->reset_domain, - &adev->kfd.reset_work); + (void )amdgpu_reset_domain_schedule (adev->reset_domain, +&adev->kfd.reset_work); } int amdgpu_amdkfd_alloc_gtt_mem(struct amdgpu_device *adev, size_tsize, @@ -714,9 +713,8 @@ void amdgpu_amdkfd_set_compute_idle(struct
amdgpu_device*adev, bool idle)Quoted 2 lines
if (gfx_block != NULL) gfx_block->version->funcs->set_powergating_state((void*)gfx_block, state);
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c static int runtime_enable(struct kfd_process *p,
Quoted 16 lines
}drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +3
-3-amdgpu_dpm_switch_power_profile (adev, -PP_SMC_POWER_PROFILE_COMPUTE , - !idle); + (void )amdgpu_dpm_switch_power_profile (adev, +PP_SMC_POWER_PROFILE_COMPUTE , !idle); + }bool amdgpu_amdkfd_is_kfd_vmid (struct amdgpu_device *adev,u32 vmid)drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +0
-0@@ -2796,8 +2796,12 @@ static int runtime_enable(struct kfd_process *p,
uint64_tr_debug,drivers/gpu/drm/amd/amdkfd/kfd_chardev.c static int runtime_enable(struct kfd_process *p, · line 2796
Quoted 1 line
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +0
-0* SET_SHADER_DEBUGGER clears any stale process context data
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c static int runtime_enable(struct kfd_process *p, uint64_t r_debug,
Quoted 4 lines
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +0
-2* saved in MES. */ -if (pdd->dev->kfd->shared_resources.enable_mes) - kfd_dbg_set_mes_debug_mode(pdd,!kfd_dbg_has_cwsr_workaround(pdd->dev));
Quoted 10 lines
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +6
-0+if (pdd->dev->kfd->shared_resources.enable_mes) { + ret =kfd_dbg_set_mes_debug_mode ( + pdd, !kfd_dbg_has_cwsr_workaround (pdd- dev)); +if (ret) +return ret; + } }p->runtime_info.runtime_state = DEBUG_RUNTIME_STATE_ENABLED;