Skip to content

Commit

Permalink
drm/xe: Fix NPD in ggtt_node_remove()
Browse files Browse the repository at this point in the history
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().

v2: Move null check below declarations (Tejas)

Fixes: 919bb54 ("drm/xe: Fix missing runtime outer protection for ggtt_remove_node")
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: Tejas Upadhyay <tejas.upadhyay@intel.com>
Reviewed-by: Tejas Upadhyay <tejas.upadhyay@intel.com>
Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240828092229.3606503-1-himal.prasad.ghimiray@intel.com
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
  • Loading branch information
Himal Prasad Ghimiray authored and Rodrigo Vivi committed Aug 28, 2024
1 parent 379cad6 commit c720841
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions drivers/gpu/drm/xe/xe_ggtt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -328,8 +325,14 @@ static void ggtt_node_remove_work_func(struct work_struct *work)
*/
void xe_ggtt_node_remove(struct xe_ggtt_node *node, bool invalidate)
{
struct xe_ggtt *ggtt = node->ggtt;
struct xe_device *xe = tile_to_xe(ggtt->tile);
struct xe_ggtt *ggtt;
struct xe_device *xe;

if (!node || !node->ggtt)
return;

ggtt = node->ggtt;
xe = tile_to_xe(ggtt->tile);

node->invalidate_on_remove = invalidate;

Expand Down

0 comments on commit c720841

Please sign in to comment.