Skip to contentSkip to conversation

gpu: drm/amd: Fix the bug in list_for_each_entry() loops

PATCH In review Lu Hongfei 2 participants 2 messages Jun 12, 2023

Subsystems (3)
lore
Share & tools
lore

Lu Hongfei

author
#0 lore raw

PATCH 1/1 gpu: drm/amd: Fix the bug in list_for_each_entry() loops

pqn bound in list_for_each_entry loop will not be null, so there is no need to check whether pqn is NULL or not.
We could remove this check.

---
 drivers/gpu/drm/amd/amdkfd/kfd_debug.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_debug.c +0 -3
index cd34e7aaead4..10d0cef844f0
@@ -1097,9 +1097,6 @@ void kfd_dbg_set_enabled_debug_exception_mask(struct kfd_process *target,
 
 	pqm = &target->pqm;
 	list_for_each_entry(pqn, &pqm->queues, process_queue_list) {
-		if (!pqn)
-			continue;
-
 		found_mask |= pqn->q->properties.exception_status;
 	}
 
Signature · 1 line
2.39.0
#1 lore raw
Quoted 2 lines

pqn bound in list_for_each_entry loop will not be null, so there is no need to check whether pqn is NULL or not.

Would it be more appropriate to use the wording “Delete an unnecessary check within a list_for_each_entry() loop” instead of
“Fix the bug in list_for_each_entry() loops” in the patch subject?

Quoted 1 line

We could remove this check.

I suggest to use the sentence “Thus remove a redundant null pointer check.”.

See also:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.4-rc6#n94

Regards,
Markus