public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915/selftests: silence a bogus spammy warning
@ 2017-06-14  9:14 Dan Carpenter
  2017-06-14  9:29 ` Chris Wilson
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2017-06-14  9:14 UTC (permalink / raw)
  To: Daniel Vetter, Chris Wilson
  Cc: David Airlie, intel-gfx, kernel-janitors, dri-devel, Matthew Auld

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")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
Static analysis.  Not tested.

diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_evict.c b/drivers/gpu/drm/i915/selftests/i915_gem_evict.c
index 14e9c2fbc4e6..0448ef9ee807 100644
--- a/drivers/gpu/drm/i915/selftests/i915_gem_evict.c
+++ b/drivers/gpu/drm/i915/selftests/i915_gem_evict.c
@@ -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;
 	}
 

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/i915/selftests: silence a bogus spammy warning
  2017-06-14  9:14 [PATCH] drm/i915/selftests: silence a bogus spammy warning Dan Carpenter
@ 2017-06-14  9:29 ` Chris Wilson
  2017-06-14  9:39   ` Dan Carpenter
  0 siblings, 1 reply; 3+ messages in thread
From: Chris Wilson @ 2017-06-14  9:29 UTC (permalink / raw)
  To: Dan Carpenter, Daniel Vetter
  Cc: intel-gfx, kernel-janitors, dri-devel, Matthew Auld

Quoting Dan Carpenter (2017-06-14 10:14:52)
> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/i915/selftests: silence a bogus spammy warning
  2017-06-14  9:29 ` Chris Wilson
@ 2017-06-14  9:39   ` Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2017-06-14  9:39 UTC (permalink / raw)
  To: Chris Wilson
  Cc: intel-gfx, kernel-janitors, dri-devel, Matthew Auld,
	Daniel Vetter

On Wed, Jun 14, 2017 at 10:29:57AM +0100, Chris Wilson wrote:
> Quoting Dan Carpenter (2017-06-14 10:14:52)
> > 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



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-06-14  9:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-14  9:14 [PATCH] drm/i915/selftests: silence a bogus spammy warning Dan Carpenter
2017-06-14  9:29 ` Chris Wilson
2017-06-14  9:39   ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox