Skip to content

Commit e863781

Browse files
matt-auldLucas De Marchi
authored andcommitted
drm/xe/ct: fix xa_store() error checking
Looks like we are meant to use xa_err() to extract the error encoded in the ptr. Fixes: dd08ebf ("drm/xe: Introduce a new DRM driver for Intel GPUs") Signed-off-by: Matthew Auld <matthew.auld@intel.com> Cc: Matthew Brost <matthew.brost@intel.com> Cc: Badal Nilawar <badal.nilawar@intel.com> Cc: <stable@vger.kernel.org> # v6.8+ Reviewed-by: Badal Nilawar <badal.nilawar@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20241001084346.98516-6-matthew.auld@intel.com (cherry picked from commit 1aa4b78) Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
1 parent db7f92a commit e863781

1 file changed

Lines changed: 8 additions & 15 deletions

File tree

drivers/gpu/drm/xe/xe_guc_ct.c

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -667,16 +667,12 @@ static int __guc_ct_send_locked(struct xe_guc_ct *ct, const u32 *action,
667667
num_g2h = 1;
668668

669669
if (g2h_fence_needs_alloc(g2h_fence)) {
670-
void *ptr;
671-
672670
g2h_fence->seqno = next_ct_seqno(ct, true);
673-
ptr = xa_store(&ct->fence_lookup,
674-
g2h_fence->seqno,
675-
g2h_fence, GFP_ATOMIC);
676-
if (IS_ERR(ptr)) {
677-
ret = PTR_ERR(ptr);
671+
ret = xa_err(xa_store(&ct->fence_lookup,
672+
g2h_fence->seqno, g2h_fence,
673+
GFP_ATOMIC));
674+
if (ret)
678675
goto out;
679-
}
680676
}
681677

682678
seqno = g2h_fence->seqno;
@@ -879,14 +875,11 @@ static int guc_ct_send_recv(struct xe_guc_ct *ct, const u32 *action, u32 len,
879875
retry_same_fence:
880876
ret = guc_ct_send(ct, action, len, 0, 0, &g2h_fence);
881877
if (unlikely(ret == -ENOMEM)) {
882-
void *ptr;
883-
884878
/* Retry allocation /w GFP_KERNEL */
885-
ptr = xa_store(&ct->fence_lookup,
886-
g2h_fence.seqno,
887-
&g2h_fence, GFP_KERNEL);
888-
if (IS_ERR(ptr))
889-
return PTR_ERR(ptr);
879+
ret = xa_err(xa_store(&ct->fence_lookup, g2h_fence.seqno,
880+
&g2h_fence, GFP_KERNEL));
881+
if (ret)
882+
return ret;
890883

891884
goto retry_same_fence;
892885
} else if (unlikely(ret)) {

0 commit comments

Comments
 (0)