[Intel-gfx] [PATCH] drm/i915/gt: Use the correct error value when kernel_context() fails

Andi Shyti andi.shyti at linux.intel.com
Thu Jun 1 14:38:02 UTC 2023


Hi Tejas,

> > > @@ -1530,8 +1530,8 @@ static int live_busywait_preempt(void *arg)
> > >   	struct drm_i915_gem_object *obj;
> > >   	struct i915_vma *vma;
> > >   	enum intel_engine_id id;
> > > -	int err = -ENOMEM;
> > >   	u32 *map;
> > > +	int err;
> 
> We could initialize err with 0 and remove err = 0 assignment below but leaving up to you. 

that assignement must be a leftover from previous patches because
err is already initialized here:

	err = i915_vma_pin(vma, 0, 0, PIN_GLOBAL);

will remove it. Thanks!

> > >
> > >   	/*
> > >   	 * Verify that even without HAS_LOGICAL_RING_PREEMPTION, we
> > can @@
> > > -1539,13 +1539,17 @@ static int live_busywait_preempt(void *arg)
> > >   	 */
> > >
> > >   	ctx_hi = kernel_context(gt->i915, NULL);
> > > -	if (!ctx_hi)
> > > -		return -ENOMEM;
> > > +	if (IS_ERR(ctx_hi))
> > > +		return PTR_ERR(ctx_hi);
> > > +
> > >   	ctx_hi->sched.priority = I915_CONTEXT_MAX_USER_PRIORITY;
> > >
> > >   	ctx_lo = kernel_context(gt->i915, NULL);
> > > -	if (!ctx_lo)
> > > +	if (IS_ERR(ctx_lo)) {
> > > +		err = PTR_ERR(ctx_lo);
> > >   		goto err_ctx_hi;
> > > +	}
> > > +
> 
> Looks fine,
> Acked-by: Tejas Upadhyay <tejas.upadhyay at intel.com>

Thank you!
Andi

> 
> > >   	ctx_lo->sched.priority = I915_CONTEXT_MIN_USER_PRIORITY;
> > >
> > >   	obj = i915_gem_object_create_internal(gt->i915, PAGE_SIZE);
> 


More information about the dri-devel mailing list