From: Tomasz Lis Date: Fri, 20 Mar 2026 14:57:33 +0000 (+0100) Subject: drm/xe: Fix confusion with locals on context creation X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3d4939c0ec011ad6dfda7c13362b3d2013425789;p=thirdparty%2Flinux.git drm/xe: Fix confusion with locals on context creation After setting a local variable, check that local value rather that checking destination at which the value will be stored later. This fixes the obvious mistake in error path; without it, allocation fail would lead to NULL dereference during context creation. Fixes: 89340099c6a4 ("drm/xe/lrc: Refactor context init into xe_lrc_ctx_init()") Signed-off-by: Tomasz Lis Cc: Raag Jadav Cc: Matthew Brost Reviewed-by: Matthew Brost Signed-off-by: Matthew Brost Link: https://patch.msgid.link/20260320145733.1337682-1-tomasz.lis@intel.com --- diff --git a/drivers/gpu/drm/xe/xe_lrc.c b/drivers/gpu/drm/xe/xe_lrc.c index 24f4c7210cfb2..9d12a0d2f0b59 100644 --- a/drivers/gpu/drm/xe/xe_lrc.c +++ b/drivers/gpu/drm/xe/xe_lrc.c @@ -1630,8 +1630,8 @@ static int xe_lrc_init(struct xe_lrc *lrc, struct xe_hw_engine *hwe, struct xe_v bo = xe_bo_create_pin_map_novm(xe, tile, bo_size, ttm_bo_type_kernel, bo_flags, false); - if (IS_ERR(lrc->bo)) - return PTR_ERR(lrc->bo); + if (IS_ERR(bo)) + return PTR_ERR(bo); lrc->bo = bo;