diff mbox series

drm/i915/selftests: fix some error codes in __cancel_reset()

Message ID 20220127084915.GC25644@kili (mailing list archive)
State New, archived
Headers show
Series drm/i915/selftests: fix some error codes in __cancel_reset() | expand

Commit Message

Dan Carpenter Jan. 27, 2022, 8:49 a.m. UTC
There were two error paths in __cancel_reset() which return success
instead of a negative error code as expected.

Fixes: 4e6835466771 ("drm/i915/selftests: Add a cancel request selftest that triggers a reset")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
From static analysis.  I am not 100% sure this.  Please review extra
carefully!

 drivers/gpu/drm/i915/selftests/i915_request.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

Andi Shyti Feb. 4, 2022, 5:45 p.m. UTC | #1
Hi Dan,

> There were two error paths in __cancel_reset() which return success
> instead of a negative error code as expected.
> 
> Fixes: 4e6835466771 ("drm/i915/selftests: Add a cancel request selftest that triggers a reset")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> >From static analysis.  I am not 100% sure this.  Please review extra
> carefully!
> 
>  drivers/gpu/drm/i915/selftests/i915_request.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/selftests/i915_request.c b/drivers/gpu/drm/i915/selftests/i915_request.c
> index 2a99dd7c2fe8..05e9f977757b 100644
> --- a/drivers/gpu/drm/i915/selftests/i915_request.c
> +++ b/drivers/gpu/drm/i915/selftests/i915_request.c
> @@ -809,7 +809,8 @@ static int __cancel_reset(struct drm_i915_private *i915,
>  	preempt_timeout_ms = engine->props.preempt_timeout_ms;
>  	engine->props.preempt_timeout_ms = 100;
>  
> -	if (igt_spinner_init(&spin, engine->gt))
> +	err = igt_spinner_init(&spin, engine->gt);
> +	if (err)
>  		goto out_restore;
>  
>  	ce = intel_context_create(engine);
> @@ -838,8 +839,10 @@ static int __cancel_reset(struct drm_i915_private *i915,
>  	}
>  
>  	nop = intel_context_create_request(ce);
> -	if (IS_ERR(nop))
> +	if (IS_ERR(nop)) {
> +		err = PTR_ERR(nop);
>  		goto out_rq;
> +	}

Looks correct to me:

Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>

Thank you,
Andi
Rodrigo Vivi Feb. 4, 2022, 9:46 p.m. UTC | #2
On Fri, Feb 04, 2022 at 06:45:51PM +0100, Andi Shyti wrote:
> Hi Dan,
> 
> > There were two error paths in __cancel_reset() which return success
> > instead of a negative error code as expected.
> > 
> > Fixes: 4e6835466771 ("drm/i915/selftests: Add a cancel request selftest that triggers a reset")
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > ---
> > >From static analysis.  I am not 100% sure this.  Please review extra
> > carefully!
> > 
> >  drivers/gpu/drm/i915/selftests/i915_request.c | 7 +++++--
> >  1 file changed, 5 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/selftests/i915_request.c b/drivers/gpu/drm/i915/selftests/i915_request.c
> > index 2a99dd7c2fe8..05e9f977757b 100644
> > --- a/drivers/gpu/drm/i915/selftests/i915_request.c
> > +++ b/drivers/gpu/drm/i915/selftests/i915_request.c
> > @@ -809,7 +809,8 @@ static int __cancel_reset(struct drm_i915_private *i915,
> >  	preempt_timeout_ms = engine->props.preempt_timeout_ms;
> >  	engine->props.preempt_timeout_ms = 100;
> >  
> > -	if (igt_spinner_init(&spin, engine->gt))
> > +	err = igt_spinner_init(&spin, engine->gt);
> > +	if (err)
> >  		goto out_restore;
> >  
> >  	ce = intel_context_create(engine);
> > @@ -838,8 +839,10 @@ static int __cancel_reset(struct drm_i915_private *i915,
> >  	}
> >  
> >  	nop = intel_context_create_request(ce);
> > -	if (IS_ERR(nop))
> > +	if (IS_ERR(nop)) {
> > +		err = PTR_ERR(nop);
> >  		goto out_rq;
> > +	}
> 
> Looks correct to me:
> 
> Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>

We need a rebased version to be sent...
Sorry for the delay here...

> 
> Thank you,
> Andi
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/selftests/i915_request.c b/drivers/gpu/drm/i915/selftests/i915_request.c
index 2a99dd7c2fe8..05e9f977757b 100644
--- a/drivers/gpu/drm/i915/selftests/i915_request.c
+++ b/drivers/gpu/drm/i915/selftests/i915_request.c
@@ -809,7 +809,8 @@  static int __cancel_reset(struct drm_i915_private *i915,
 	preempt_timeout_ms = engine->props.preempt_timeout_ms;
 	engine->props.preempt_timeout_ms = 100;
 
-	if (igt_spinner_init(&spin, engine->gt))
+	err = igt_spinner_init(&spin, engine->gt);
+	if (err)
 		goto out_restore;
 
 	ce = intel_context_create(engine);
@@ -838,8 +839,10 @@  static int __cancel_reset(struct drm_i915_private *i915,
 	}
 
 	nop = intel_context_create_request(ce);
-	if (IS_ERR(nop))
+	if (IS_ERR(nop)) {
+		err = PTR_ERR(nop);
 		goto out_rq;
+	}
 	i915_request_get(nop);
 	i915_request_add(nop);