Skip to contentSkip to conversation

drm/i915/selftests: Fix some error codes

PATCH In review Dan Carpenter 4 participants 6 messages Jan 11, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915/selftests: Fix some error codes

These error paths return success instead of negative error codes as intended.

Fixes c92724de6db1 ("drm/i915/selftests: Try to detect rollback during batchbuffer preemption")
Fixes 2d19a71ce68f ("drm/i915/selftests: Exercise long preemption chains")
---
 drivers/gpu/drm/i915/gt/selftest_lrc.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/gt/selftest_lrc.c +9 -3
index 95d41c01d0e0..0f9fbae98158 100644
@@ -2679,8 +2679,10 @@ static int create_gang(struct intel_engine_cs *engine,
 		goto err_obj;
 
 	cs = i915_gem_object_pin_map(obj, I915_MAP_WC);
-	if (IS_ERR(cs))
+	if (IS_ERR(cs)) {
+		err = PTR_ERR(cs);
 		goto err_obj;
+	}
 
 	/* Semaphore target: spin until zero */
 	*cs++ = MI_ARB_ON_OFF | MI_ARB_ENABLE;
@@ -2707,8 +2709,10 @@ static int create_gang(struct intel_engine_cs *engine,
 	i915_gem_object_unpin_map(obj);
 
 	rq = intel_context_create_request(ce);
-	if (IS_ERR(rq))
+	if (IS_ERR(rq)) {
+		err = PTR_ERR(rq);
 		goto err_obj;
+	}
 
 	rq->batch = i915_vma_get(vma);
 	i915_request_get(rq);
@@ -3264,8 +3268,10 @@ static int live_preempt_user(void *arg)
 
 			rq = create_gpr_client(engine, global,
 					       NUM_GPR * i * sizeof(u32));
-			if (IS_ERR(rq))
+			if (IS_ERR(rq)) {
+				err = PTR_ERR(rq);
 				goto end_test;
+			}
 
 			client[i] = rq;
 		}
Signature · 1 line
2.29.2
Reviewed-by on v1 1/1
#1 lore raw

Quoting Dan Carpenter (2021-01-11 13:02:45)

Quoted 27 lines

These error paths return success instead of negative error codes as intended.

Fixes c92724de6db1 ("drm/i915/selftests: Try to detect rollback during batchbuffer preemption")
Fixes 2d19a71ce68f ("drm/i915/selftests: Exercise long preemption chains")
---
 drivers/gpu/drm/i915/gt/selftest_lrc.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/gt/selftest_lrc.c +3 -1
index 95d41c01d0e0..0f9fbae98158 100644
@@ -2679,8 +2679,10 @@ static int create_gang(struct intel_engine_cs *engine,
                goto err_obj;
 
        cs = i915_gem_object_pin_map(obj, I915_MAP_WC);
-       if (IS_ERR(cs))
+       if (IS_ERR(cs)) {
+               err = PTR_ERR(cs);
                goto err_obj;
+       }
 
        /* Semaphore target: spin until zero */
        *cs++ = MI_ARB_ON_OFF | MI_ARB_ENABLE;

drivers/gpu/drm/i915/gt/selftest_lrc.c static int create_gang(struct intel_engine_cs *engine, · line 2715

Quoted 8 lines
drivers/gpu/drm/i915/gt/selftest_lrc.c +3 -1
@@ -2707,8 +2709,10 @@ static int create_gang(struct intel_engine_cs *engine,
        i915_gem_object_unpin_map(obj);
 
        rq = intel_context_create_request(ce);
-       if (IS_ERR(rq))
+       if (IS_ERR(rq)) {
+               err = PTR_ERR(rq);
                goto err_obj;
+       }

Smatch already caught this pair for us, thanks.

drivers/gpu/drm/i915/gt/selftest_lrc.c static int live_preempt_user(void *arg) · line 3274

Quoted 11 lines
drivers/gpu/drm/i915/gt/selftest_lrc.c +3 -1
        rq->batch = i915_vma_get(vma);
        i915_request_get(rq);
@@ -3264,8 +3268,10 @@ static int live_preempt_user(void *arg)
 
                        rq = create_gpr_client(engine, global,
                                               NUM_GPR * i * sizeof(u32));
-                       if (IS_ERR(rq))
+                       if (IS_ERR(rq)) {
+                               err = PTR_ERR(rq);
                                goto end_test;
+                       }

But it hasn't yet caught this one.

-Chris

#2 lore raw

PATCH v2 1/1 drm/i915: selftest_lrc: Fix error code in live_preempt_user()

This error path should return a negative error code instead of success.

Fixes c92724de6db1 ("drm/i915/selftests: Try to detect rollback during batchbuffer preemption")

---
v2: The first version of the patch fixed some other error paths but
those have already been fixed.

 drivers/gpu/drm/i915/gt/selftest_lrc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/gt/selftest_lrc.c +3 -1
index 95d41c01d0e0..e11d6bb26e86 100644
@@ -3264,8 +3264,10 @@ static int live_preempt_user(void *arg)
 
 			rq = create_gpr_client(engine, global,
 					       NUM_GPR * i * sizeof(u32));
-			if (IS_ERR(rq))
+			if (IS_ERR(rq)) {
+				err = PTR_ERR(rq);
 				goto end_test;
+			}
 
 			client[i] = rq;
 		}
Signature · 1 line
2.29.2
#4 lore raw

[Intel-gfx] ✗ Fi.CI.BUILD: failure for drm/i915/selftests: Fix some error codes (rev2)

In reply to Dan Carpenter
== Series Details ==

== Series Details ==

Series: drm/i915/selftests: Fix some error codes (rev2)
URL : https://patchwork.freedesktop.org/series/85704/
State : failure

== Summary ==

Applying: drm/i915: selftest_lrc: Fix error code in live_preempt_user() Using index info to reconstruct a base tree...
M drivers/gpu/drm/i915/gt/selftest_lrc.c
Falling back to patching base and 3-way merge...
Auto-merging drivers/gpu/drm/i915/gt/selftest_lrc.c
CONFLICT (content): Merge conflict in drivers/gpu/drm/i915/gt/selftest_lrc.c
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch Patch failed at 0001 drm/i915: selftest_lrc: Fix error code in live_preempt_user() When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw

Re: [Intel-gfx] ✗ Fi.CI.BUILD: failure for drm/i915/selftests: Fix some error codes (rev2)

Quoting Patchwork (2021-01-11 14:52:15)

Quoted 6 lines

== Series Details ==

Series: drm/i915/selftests: Fix some error codes (rev2)
URL : https://patchwork.freedesktop.org/series/85704/
State : failure

Quoted 8 lines

== Summary ==

Applying: drm/i915: selftest_lrc: Fix error code in live_preempt_user() Using index info to reconstruct a base tree...
M drivers/gpu/drm/i915/gt/selftest_lrc.c
Falling back to patching base and 3-way merge...
Auto-merging drivers/gpu/drm/i915/gt/selftest_lrc.c
CONFLICT (content): Merge conflict in drivers/gpu/drm/i915/gt/selftest_lrc.c

Don't worry; I've applied the patch manually and pushed.

Thanks,
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reviewed-by on v2 1/1
#3 lore raw

Re: [PATCH v2] drm/i915: selftest_lrc: Fix error code in live_preempt_user()

In reply to Dan Carpenter

Hi Dan,

Quoted 5 lines · Dan Carpenter

This error path should return a negative error code instead of success.

Fixes c92724de6db1 ("drm/i915/selftests: Try to detect rollback during batchbuffer preemption")

Thanks,
Andi