Skip to contentSkip to conversation

drm/i915/selftests: silence a bogus spammy warning

PATCH In review Dan Carpenter 2 participants 3 messages Jun 14, 2017

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

PATCH 1/1 drm/i915/selftests: silence a bogus spammy warning

These tests are reversed so it complains on every successful call and stays quiet for every failure. Also we may as well preserve the error code.

Fixes f40a7b7558ef ("drm/i915: Initial selftests for exercising eviction")

---
Static analysis. Not tested.

drivers/gpu/drm/i915/selftests/i915_gem_evict.c +2 -2
index 14e9c2fbc4e6..0448ef9ee807 100644
@@ -152,9 +152,9 @@ static int igt_overcommit(void *arg)
 	list_move(&obj->global_link, &i915->mm.unbound_list);
 
 	vma = i915_gem_object_ggtt_pin(obj, NULL, 0, 0, 0);
-	if (!IS_ERR(vma) || PTR_ERR(vma) != -ENOSPC) {
+	if (IS_ERR(vma) && PTR_ERR(vma) != -ENOSPC) {
 		pr_err("Failed to evict+insert, i915_gem_object_ggtt_pin returned err=%d\n", (int)PTR_ERR(vma));
-		err = -EINVAL;
+		err = PTR_ERR(vma);
 		goto cleanup;
 	}
 

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

#1 lore raw

Quoting Dan Carpenter (2017-06-14 10:14:52)

Quoted 3 lines

These tests are reversed so it complains on every successful call and stays quiet for every failure. Also we may as well preserve the error code.

The test is correct. The expectation here is that i915_gem_object_ggtt_pin() fails and reports ENOSPC as we have already allocated the entire GGTT. If it doesn't then we report the test failure.
-Chris
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#2 lore raw
Quoted 9 lines · Chris Wilson

Quoting Dan Carpenter (2017-06-14 10:14:52)

Quoted 3 lines

These tests are reversed so it complains on every successful call and stays quiet for every failure. Also we may as well preserve the error code.

The test is correct. The expectation here is that i915_gem_object_ggtt_pin() fails and reports ENOSPC as we have already allocated the entire GGTT. If it doesn't then we report the test failure.
-Chris

Ah. Ok. Thanks.

This was triggering a static checker warning because we're passing a valid pointer to PTR_ERR(). Probably the easiest thing is just to ignore the warning...

regards,
dan carpenter

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel