Skip to content

Commit 4002395

Browse files
Andi Shytijlahtine-intel
authored andcommitted
drm/i915/gt: Use the correct error value when kernel_context() fails
kernel_context() returns an error pointer. Use pointer-error conversion functions to evaluate its return value, rather than checking for a '0' return. Fixes: eb5c10c ("drm/i915: Remove I915_USER_PRIORITY_SHIFT") Reported-by: Dan Carpenter <dan.carpenter@linaro.org> Signed-off-by: Andi Shyti <andi.shyti@linux.intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: <stable@vger.kernel.org> # v5.13+ Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com> Acked-by: Tejas Upadhyay <tejas.upadhyay@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230526124138.2006110-1-andi.shyti@linux.intel.com (cherry picked from commit edad9ee) Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
1 parent 9561de3 commit 4002395

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

drivers/gpu/drm/i915/gt/selftest_execlists.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1530,22 +1530,26 @@ static int live_busywait_preempt(void *arg)
15301530
struct drm_i915_gem_object *obj;
15311531
struct i915_vma *vma;
15321532
enum intel_engine_id id;
1533-
int err = -ENOMEM;
15341533
u32 *map;
1534+
int err;
15351535

15361536
/*
15371537
* Verify that even without HAS_LOGICAL_RING_PREEMPTION, we can
15381538
* preempt the busywaits used to synchronise between rings.
15391539
*/
15401540

15411541
ctx_hi = kernel_context(gt->i915, NULL);
1542-
if (!ctx_hi)
1543-
return -ENOMEM;
1542+
if (IS_ERR(ctx_hi))
1543+
return PTR_ERR(ctx_hi);
1544+
15441545
ctx_hi->sched.priority = I915_CONTEXT_MAX_USER_PRIORITY;
15451546

15461547
ctx_lo = kernel_context(gt->i915, NULL);
1547-
if (!ctx_lo)
1548+
if (IS_ERR(ctx_lo)) {
1549+
err = PTR_ERR(ctx_lo);
15481550
goto err_ctx_hi;
1551+
}
1552+
15491553
ctx_lo->sched.priority = I915_CONTEXT_MIN_USER_PRIORITY;
15501554

15511555
obj = i915_gem_object_create_internal(gt->i915, PAGE_SIZE);

0 commit comments

Comments
 (0)