Skip to content

Commit c720841

Browse files
hghimirarodrigovivi
authored andcommitted
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(). v2: Move null check below declarations (Tejas) Fixes: 919bb54 ("drm/xe: Fix missing runtime outer protection for ggtt_remove_node") Cc: Rodrigo Vivi <[email protected]> Cc: Lucas De Marchi <[email protected]> Cc: Tejas Upadhyay <[email protected]> Reviewed-by: Tejas Upadhyay <[email protected]> Signed-off-by: Himal Prasad Ghimiray <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Rodrigo Vivi <[email protected]>
1 parent 379cad6 commit c720841

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

drivers/gpu/drm/xe/xe_ggtt.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -286,9 +286,6 @@ static void ggtt_node_remove(struct xe_ggtt_node *node)
286286
bool bound;
287287
int idx;
288288

289-
if (!node || !node->ggtt)
290-
return;
291-
292289
bound = drm_dev_enter(&xe->drm, &idx);
293290

294291
mutex_lock(&ggtt->lock);
@@ -328,8 +325,14 @@ static void ggtt_node_remove_work_func(struct work_struct *work)
328325
*/
329326
void xe_ggtt_node_remove(struct xe_ggtt_node *node, bool invalidate)
330327
{
331-
struct xe_ggtt *ggtt = node->ggtt;
332-
struct xe_device *xe = tile_to_xe(ggtt->tile);
328+
struct xe_ggtt *ggtt;
329+
struct xe_device *xe;
330+
331+
if (!node || !node->ggtt)
332+
return;
333+
334+
ggtt = node->ggtt;
335+
xe = tile_to_xe(ggtt->tile);
333336

334337
node->invalidate_on_remove = invalidate;
335338

0 commit comments

Comments
 (0)