Skip to content

Commit edce042

Browse files
Thomas Hellströmlucasdemarchi
authored andcommitted
drm/xe: Fix uninitialized return value from xe_validation_guard()
the DEFINE_CLASS() macro creates an inline function and the init args are passed down to it; since _ret is passed as an int, whatever value is set inside the function is not visible to the caller. Pass _ret as a pointer so its value propagates to the caller. Fixes: c460bc2 ("drm/xe: Introduce an xe_validation wrapper around drm_exec") Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/6220 Cc: Maarten Lankhorst <[email protected]> Cc: Matthew Brost <[email protected]> Cc: [email protected] Signed-off-by: Thomas Hellström <[email protected]> Reviewed-by: Lucas De Marchi <[email protected]> Reviewed-by: Maarten Lankhorst <[email protected]> Reviewed-by: Matthew Brost <[email protected]> Link: https://patch.msgid.link/[email protected] (cherry picked from commit fcb8c304f4673747d535c74b340b5b8a4823727b) Signed-off-by: Lucas De Marchi <[email protected]>
1 parent dcb6fa3 commit edce042

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/gpu/drm/xe/xe_validation.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,10 @@ xe_validation_device_init(struct xe_validation_device *val)
166166
*/
167167
DEFINE_CLASS(xe_validation, struct xe_validation_ctx *,
168168
if (_T) xe_validation_ctx_fini(_T);,
169-
({_ret = xe_validation_ctx_init(_ctx, _val, _exec, _flags);
170-
_ret ? NULL : _ctx; }),
169+
({*_ret = xe_validation_ctx_init(_ctx, _val, _exec, _flags);
170+
*_ret ? NULL : _ctx; }),
171171
struct xe_validation_ctx *_ctx, struct xe_validation_device *_val,
172-
struct drm_exec *_exec, const struct xe_val_flags _flags, int _ret);
172+
struct drm_exec *_exec, const struct xe_val_flags _flags, int *_ret);
173173
static inline void *class_xe_validation_lock_ptr(class_xe_validation_t *_T)
174174
{return *_T; }
175175
#define class_xe_validation_is_conditional true
@@ -186,7 +186,7 @@ static inline void *class_xe_validation_lock_ptr(class_xe_validation_t *_T)
186186
* exhaustive eviction.
187187
*/
188188
#define xe_validation_guard(_ctx, _val, _exec, _flags, _ret) \
189-
scoped_guard(xe_validation, _ctx, _val, _exec, _flags, _ret) \
189+
scoped_guard(xe_validation, _ctx, _val, _exec, _flags, &_ret) \
190190
drm_exec_until_all_locked(_exec)
191191

192192
#endif

0 commit comments

Comments
 (0)