public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] gpu: drm/amd: Remove the redundant null pointer check in list_for_each_entry() loops
@ 2023-06-12 11:58 Lu Hongfei
  2023-06-12 15:25 ` Felix Kuehling
  0 siblings, 1 reply; 3+ messages in thread
From: Lu Hongfei @ 2023-06-12 11:58 UTC (permalink / raw)
  To: Felix Kuehling, Alex Deucher, Christian König, Pan, Xinhui,
	David Airlie, Daniel Vetter, open list:AMD KFD,
	open list:DRM DRIVERS, open list
  Cc: opensource.kernel, luhongfei

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.
Thus remove a redundant null pointer check.

Signed-off-by: Lu Hongfei <luhongfei@vivo.com>
---
The filename of the previous version was:
0001-gpu-drm-amd-Fix-the-bug-in-list_for_each_entry-loops.patch

The modifications made compared to the previous version are as follows:
1. Modified the patch title
2. "Thus remove a redundant null pointer check." is used instead of
   "We could remove this check."

 drivers/gpu/drm/amd/amdkfd/kfd_debug.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_debug.c b/drivers/gpu/drm/amd/amdkfd/kfd_debug.c
index cd34e7aaead4..10d0cef844f0 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_debug.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_debug.c
@@ -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;
 	}
 
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] gpu: drm/amd: Remove the redundant null pointer check in list_for_each_entry() loops
  2023-06-12 11:58 [PATCH v2] gpu: drm/amd: Remove the redundant null pointer check in list_for_each_entry() loops Lu Hongfei
@ 2023-06-12 15:25 ` Felix Kuehling
  2023-06-12 15:39   ` Kim, Jonathan
  0 siblings, 1 reply; 3+ messages in thread
From: Felix Kuehling @ 2023-06-12 15:25 UTC (permalink / raw)
  To: Lu Hongfei, Alex Deucher, Christian König, Pan, Xinhui,
	David Airlie, Daniel Vetter, open list:AMD KFD,
	open list:DRM DRIVERS, open list, Kim, Jonathan
  Cc: opensource.kernel

[+Jon]

Am 2023-06-12 um 07:58 schrieb Lu Hongfei:
> 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.
> Thus remove a redundant null pointer check.
>
> Signed-off-by: Lu Hongfei <luhongfei@vivo.com>
> ---
> The filename of the previous version was:
> 0001-gpu-drm-amd-Fix-the-bug-in-list_for_each_entry-loops.patch
>
> The modifications made compared to the previous version are as follows:
> 1. Modified the patch title
> 2. "Thus remove a redundant null pointer check." is used instead of
>     "We could remove this check."
>
>   drivers/gpu/drm/amd/amdkfd/kfd_debug.c | 3 ---
>   1 file changed, 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_debug.c b/drivers/gpu/drm/amd/amdkfd/kfd_debug.c
> index cd34e7aaead4..10d0cef844f0 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_debug.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_debug.c
> @@ -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)

Right, this check doesn't make a lot of sense. Jon, was this meant to 
check pqn->q?

Regards,
   Felix


> -			continue;
> -
>   		found_mask |= pqn->q->properties.exception_status;
>   	}
>   

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH v2] gpu: drm/amd: Remove the redundant null pointer check in list_for_each_entry() loops
  2023-06-12 15:25 ` Felix Kuehling
@ 2023-06-12 15:39   ` Kim, Jonathan
  0 siblings, 0 replies; 3+ messages in thread
From: Kim, Jonathan @ 2023-06-12 15:39 UTC (permalink / raw)
  To: Kuehling, Felix, Lu Hongfei, Deucher, Alexander,
	Koenig, Christian, Pan, Xinhui, David Airlie, Daniel Vetter,
	open list:AMD KFD, open list:DRM DRIVERS, open list
  Cc: opensource.kernel@vivo.com

[Public]

> -----Original Message-----
> From: Kuehling, Felix <Felix.Kuehling@amd.com>
> Sent: Monday, June 12, 2023 11:25 AM
> To: Lu Hongfei <luhongfei@vivo.com>; Deucher, Alexander
> <Alexander.Deucher@amd.com>; Koenig, Christian
> <Christian.Koenig@amd.com>; Pan, Xinhui <Xinhui.Pan@amd.com>; David
> Airlie <airlied@gmail.com>; Daniel Vetter <daniel@ffwll.ch>; open list:AMD
> KFD <amd-gfx@lists.freedesktop.org>; open list:DRM DRIVERS <dri-
> devel@lists.freedesktop.org>; open list <linux-kernel@vger.kernel.org>; Kim,
> Jonathan <Jonathan.Kim@amd.com>
> Cc: opensource.kernel@vivo.com
> Subject: Re: [PATCH v2] gpu: drm/amd: Remove the redundant null pointer
> check in list_for_each_entry() loops
>
> [+Jon]
>
> Am 2023-06-12 um 07:58 schrieb Lu Hongfei:
> > 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.
> > Thus remove a redundant null pointer check.
> >
> > Signed-off-by: Lu Hongfei <luhongfei@vivo.com>
> > ---
> > The filename of the previous version was:
> > 0001-gpu-drm-amd-Fix-the-bug-in-list_for_each_entry-loops.patch
> >
> > The modifications made compared to the previous version are as follows:
> > 1. Modified the patch title
> > 2. "Thus remove a redundant null pointer check." is used instead of
> >     "We could remove this check."
> >
> >   drivers/gpu/drm/amd/amdkfd/kfd_debug.c | 3 ---
> >   1 file changed, 3 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_debug.c
> b/drivers/gpu/drm/amd/amdkfd/kfd_debug.c
> > index cd34e7aaead4..10d0cef844f0 100644
> > --- a/drivers/gpu/drm/amd/amdkfd/kfd_debug.c
> > +++ b/drivers/gpu/drm/amd/amdkfd/kfd_debug.c
> > @@ -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)
>
> Right, this check doesn't make a lot of sense. Jon, was this meant to
> check pqn->q?

Yes that's a bug.  It should be a null check on the queue itself.
I'll send out the fix shortly.

Thanks,

Jon

>
> Regards,
>    Felix
>
>
> > -                   continue;
> > -
> >             found_mask |= pqn->q->properties.exception_status;
> >     }
> >

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-06-12 15:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-12 11:58 [PATCH v2] gpu: drm/amd: Remove the redundant null pointer check in list_for_each_entry() loops Lu Hongfei
2023-06-12 15:25 ` Felix Kuehling
2023-06-12 15:39   ` Kim, Jonathan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox