[PATCH 1/1] drm/xe: Fix NPD in ggtt_node_remove()

Upadhyay, Tejas tejas.upadhyay at intel.com
Wed Aug 28 08:50:18 UTC 2024



> -----Original Message-----
> From: Upadhyay, Tejas
> Sent: Wednesday, August 28, 2024 2:13 PM
> To: Ghimiray, Himal Prasad <himal.prasad.ghimiray at intel.com>; intel-
> xe at lists.freedesktop.org
> Cc: Vivi, Rodrigo <rodrigo.vivi at intel.com>; De Marchi, Lucas
> <lucas.demarchi at intel.com>
> Subject: RE: [PATCH 1/1] drm/xe: Fix NPD in ggtt_node_remove()
> 
> 
> 
> > -----Original Message-----
> > From: Ghimiray, Himal Prasad <himal.prasad.ghimiray at intel.com>
> > Sent: Wednesday, August 28, 2024 2:25 PM
> > To: intel-xe at lists.freedesktop.org
> > Cc: Ghimiray, Himal Prasad <himal.prasad.ghimiray at intel.com>; Vivi,
> > Rodrigo <rodrigo.vivi at intel.com>; De Marchi, Lucas
> > <lucas.demarchi at intel.com>; Upadhyay, Tejas <tejas.upadhyay at intel.com>
> > Subject: [PATCH 1/1] drm/xe: Fix NPD in ggtt_node_remove()
> >
> > Make sure that ggtt_node_remove() is invoked only if both node and
> > ggtt are not null. Move the null checks to the caller function
> xe_ggtt_node_remove().
> >
> > Fixes: 919bb54e989c ("drm/xe: Fix missing runtime outer protection for
> > ggtt_remove_node")
> > Cc: Rodrigo Vivi <rodrigo.vivi at intel.com>
> > Cc: Lucas De Marchi <lucas.demarchi at intel.com>
> > Cc: Tejas Upadhyay <tejas.upadhyay at intel.com>
> > Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray at intel.com>
> > ---
> >  drivers/gpu/drm/xe/xe_ggtt.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/xe/xe_ggtt.c
> > b/drivers/gpu/drm/xe/xe_ggtt.c index 86fc6afa43bd..2fa8a22ebbf9 100644
> > --- a/drivers/gpu/drm/xe/xe_ggtt.c
> > +++ b/drivers/gpu/drm/xe/xe_ggtt.c
> > @@ -286,9 +286,6 @@ static void ggtt_node_remove(struct xe_ggtt_node
> > *node)
> >  	bool bound;
> >  	int idx;
> >
> > -	if (!node || !node->ggtt)
> > -		return;
> > -
> >  	bound = drm_dev_enter(&xe->drm, &idx);
> >
> >  	mutex_lock(&ggtt->lock);
> > @@ -328,6 +325,9 @@ static void ggtt_node_remove_work_func(struct
> > work_struct *work)
> >   */
> >  void xe_ggtt_node_remove(struct xe_ggtt_node *node, bool invalidate)
> > {
> > +	if (!node || !node->ggtt)
> > +		return;
> > +
> 
> I think better to declare and assign after NULL check. Something like below,
> struct xe_ggtt *ggtt; struct xe_device *xe; ....
> ....
> if (!node || !node->ggtt)
>          return;
> ggtt = node->ggtt;
> xe = tile_to_xe(ggtt->tile);
> 

With that, 
Reviewed-by: Tejas Upadhyay <tejas.upadhyay at intel.com>

> Thanks,
> Tejas
> >  	struct xe_ggtt *ggtt = node->ggtt;
> >  	struct xe_device *xe = tile_to_xe(ggtt->tile);
> >
> > --
> > 2.34.1



More information about the Intel-xe mailing list