Skip to content
This repository was archived by the owner on Oct 31, 2024. It is now read-only.

Commit 69459bc

Browse files
matt-auldgregkh
authored andcommitted
drm/xe/ct: fix xa_store() error checking
commit e863781 upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 8ed7dd4 commit 69459bc

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

drivers/gpu/drm/xe/xe_guc_ct.c

+8-15
Original file line numberDiff line numberDiff line change
@@ -658,16 +658,12 @@ static int __guc_ct_send_locked(struct xe_guc_ct *ct, const u32 *action,
658658
num_g2h = 1;
659659

660660
if (g2h_fence_needs_alloc(g2h_fence)) {
661-
void *ptr;
662-
663661
g2h_fence->seqno = next_ct_seqno(ct, true);
664-
ptr = xa_store(&ct->fence_lookup,
665-
g2h_fence->seqno,
666-
g2h_fence, GFP_ATOMIC);
667-
if (IS_ERR(ptr)) {
668-
ret = PTR_ERR(ptr);
662+
ret = xa_err(xa_store(&ct->fence_lookup,
663+
g2h_fence->seqno, g2h_fence,
664+
GFP_ATOMIC));
665+
if (ret)
669666
goto out;
670-
}
671667
}
672668

673669
seqno = g2h_fence->seqno;
@@ -870,14 +866,11 @@ static int guc_ct_send_recv(struct xe_guc_ct *ct, const u32 *action, u32 len,
870866
retry_same_fence:
871867
ret = guc_ct_send(ct, action, len, 0, 0, &g2h_fence);
872868
if (unlikely(ret == -ENOMEM)) {
873-
void *ptr;
874-
875869
/* Retry allocation /w GFP_KERNEL */
876-
ptr = xa_store(&ct->fence_lookup,
877-
g2h_fence.seqno,
878-
&g2h_fence, GFP_KERNEL);
879-
if (IS_ERR(ptr))
880-
return PTR_ERR(ptr);
870+
ret = xa_err(xa_store(&ct->fence_lookup, g2h_fence.seqno,
871+
&g2h_fence, GFP_KERNEL));
872+
if (ret)
873+
return ret;
881874

882875
goto retry_same_fence;
883876
} else if (unlikely(ret)) {

0 commit comments

Comments
 (0)