diff mbox series

[2/2] drm/i915/selftests: Careful not to flush hang_fini on error setups

Message ID 20190726125456.31364-2-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show
Series [1/2] drm/i915/perf: Initialise err to 0 before looping over ce->engines | expand

Commit Message

Chris Wilson July 26, 2019, 12:54 p.m. UTC
Smatch spotted that we test at the start of hang_fini for a valid (h->gt
is only set after a request is created) but then used it regardless
later on.

Fixes: cb823ed9915b ("drm/i915/gt: Use intel_gt as the primary object for handling resets")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
---
 drivers/gpu/drm/i915/gt/selftest_hangcheck.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Tvrtko Ursulin July 29, 2019, 7:53 a.m. UTC | #1
On 26/07/2019 13:54, Chris Wilson wrote:
> Smatch spotted that we test at the start of hang_fini for a valid (h->gt
> is only set after a request is created) but then used it regardless
> later on.
> 
> Fixes: cb823ed9915b ("drm/i915/gt: Use intel_gt as the primary object for handling resets")
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> ---
>   drivers/gpu/drm/i915/gt/selftest_hangcheck.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/gt/selftest_hangcheck.c b/drivers/gpu/drm/i915/gt/selftest_hangcheck.c
> index e2fa38a1ff0f..a4fc73b4368f 100644
> --- a/drivers/gpu/drm/i915/gt/selftest_hangcheck.c
> +++ b/drivers/gpu/drm/i915/gt/selftest_hangcheck.c
> @@ -284,7 +284,8 @@ static void hang_fini(struct hang *h)
>   
>   	kernel_context_close(h->ctx);
>   
> -	igt_flush_test(h->gt->i915, I915_WAIT_LOCKED);
> +	if (h->gt)
> +		igt_flush_test(h->gt->i915, I915_WAIT_LOCKED);

I see h->gt always set in hang_init. I think it used to be not the case 
in my initial refactoring. So even the earlier check in hang_fini could 
be removed now.

Regards,

Tvrtko

>   }
>   
>   static bool wait_until_running(struct hang *h, struct i915_request *rq)
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gt/selftest_hangcheck.c b/drivers/gpu/drm/i915/gt/selftest_hangcheck.c
index e2fa38a1ff0f..a4fc73b4368f 100644
--- a/drivers/gpu/drm/i915/gt/selftest_hangcheck.c
+++ b/drivers/gpu/drm/i915/gt/selftest_hangcheck.c
@@ -284,7 +284,8 @@  static void hang_fini(struct hang *h)
 
 	kernel_context_close(h->ctx);
 
-	igt_flush_test(h->gt->i915, I915_WAIT_LOCKED);
+	if (h->gt)
+		igt_flush_test(h->gt->i915, I915_WAIT_LOCKED);
 }
 
 static bool wait_until_running(struct hang *h, struct i915_request *rq)