All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Subject: [PATCH] drm/i915/selftests: Be explicit in ERR_PTR handling
Date: Fri, 15 Nov 2019 12:55:43 +0000	[thread overview]
Message-ID: <20191115125543.856274-1-chris@chris-wilson.co.uk> (raw)
In-Reply-To: <3a147809-2dae-4840-8a06-d2b786aa3a31@linux.intel.com>

When setting up a full GGTT, we expect the next insert to fail with
-ENOSPC. Simplify the use of ERR_PTR to not confuse either the reader or
smatch.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
References: f40a7b7558ef ("drm/i915: Initial selftests for exercising eviction")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/selftests/i915_gem_evict.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_evict.c b/drivers/gpu/drm/i915/selftests/i915_gem_evict.c
index 5f133d177212..06ef88510209 100644
--- a/drivers/gpu/drm/i915/selftests/i915_gem_evict.c
+++ b/drivers/gpu/drm/i915/selftests/i915_gem_evict.c
@@ -198,8 +198,8 @@ static int igt_overcommit(void *arg)
 	quirk_add(obj, &objects);
 
 	vma = i915_gem_object_ggtt_pin(obj, NULL, 0, 0, 0);
-	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));
+	if (vma != ERR_PTR(-ENOSPC)) {
+		pr_err("Failed to evict+insert, i915_gem_object_ggtt_pin returned err=%d\n", (int)PTR_ERR_OR_ZERO(vma));
 		err = -EINVAL;
 		goto cleanup;
 	}
-- 
2.24.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

WARNING: multiple messages have this Message-ID (diff)
From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Subject: [Intel-gfx] [PATCH] drm/i915/selftests: Be explicit in ERR_PTR handling
Date: Fri, 15 Nov 2019 12:55:43 +0000	[thread overview]
Message-ID: <20191115125543.856274-1-chris@chris-wilson.co.uk> (raw)
Message-ID: <20191115125543.JLNJWiLZVk0knyh4d42E3jEaBxY8__OR_fAIoCnicQw@z> (raw)
In-Reply-To: <3a147809-2dae-4840-8a06-d2b786aa3a31@linux.intel.com>

When setting up a full GGTT, we expect the next insert to fail with
-ENOSPC. Simplify the use of ERR_PTR to not confuse either the reader or
smatch.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
References: f40a7b7558ef ("drm/i915: Initial selftests for exercising eviction")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/selftests/i915_gem_evict.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_evict.c b/drivers/gpu/drm/i915/selftests/i915_gem_evict.c
index 5f133d177212..06ef88510209 100644
--- a/drivers/gpu/drm/i915/selftests/i915_gem_evict.c
+++ b/drivers/gpu/drm/i915/selftests/i915_gem_evict.c
@@ -198,8 +198,8 @@ static int igt_overcommit(void *arg)
 	quirk_add(obj, &objects);
 
 	vma = i915_gem_object_ggtt_pin(obj, NULL, 0, 0, 0);
-	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));
+	if (vma != ERR_PTR(-ENOSPC)) {
+		pr_err("Failed to evict+insert, i915_gem_object_ggtt_pin returned err=%d\n", (int)PTR_ERR_OR_ZERO(vma));
 		err = -EINVAL;
 		goto cleanup;
 	}
-- 
2.24.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2019-11-15 12:55 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-14 22:57 [PATCH 1/5] drm/i915/gt: Wait for new requests in intel_gt_retire_requests() Chris Wilson
2019-11-14 22:57 ` [Intel-gfx] " Chris Wilson
2019-11-14 22:57 ` [PATCH 2/5] drm/i915/selftests: Exercise rc6 handling Chris Wilson
2019-11-14 22:57   ` [Intel-gfx] " Chris Wilson
2019-11-14 22:57 ` [PATCH 3/5] drm/i915/selftests: Be explicit in ERR_PTR handling Chris Wilson
2019-11-14 22:57   ` [Intel-gfx] " Chris Wilson
2019-11-15 12:47   ` Tvrtko Ursulin
2019-11-15 12:47     ` [Intel-gfx] " Tvrtko Ursulin
2019-11-15 12:55     ` Chris Wilson [this message]
2019-11-15 12:55       ` [Intel-gfx] [PATCH] " Chris Wilson
2019-11-14 22:57 ` [PATCH 4/5] drm/i915/selftests: Exercise long preemption chains Chris Wilson
2019-11-14 22:57   ` [Intel-gfx] " Chris Wilson
2019-11-15 12:50   ` Tvrtko Ursulin
2019-11-15 12:50     ` [Intel-gfx] " Tvrtko Ursulin
2019-11-14 22:57 ` [PATCH 5/5] drm/i915/gem: Silence sparse for RCU protection inside the constructor Chris Wilson
2019-11-14 22:57   ` [Intel-gfx] " Chris Wilson
2019-11-15 12:55   ` Tvrtko Ursulin
2019-11-15 12:55     ` [Intel-gfx] " Tvrtko Ursulin
2019-11-15  0:12 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/5] drm/i915/gt: Wait for new requests in intel_gt_retire_requests() Patchwork
2019-11-15  0:12   ` [Intel-gfx] " Patchwork
2019-11-15  0:34 ` ✓ Fi.CI.BAT: success " Patchwork
2019-11-15  0:34   ` [Intel-gfx] " Patchwork
2019-11-15 12:45 ` [PATCH 1/5] " Tvrtko Ursulin
2019-11-15 12:45   ` [Intel-gfx] " Tvrtko Ursulin
2019-11-15 12:49   ` Chris Wilson
2019-11-15 12:49     ` [Intel-gfx] " Chris Wilson
2019-11-15 12:56     ` Tvrtko Ursulin
2019-11-15 12:56       ` [Intel-gfx] " Tvrtko Ursulin
2019-11-15 17:18 ` ✗ Fi.CI.BUILD: failure for series starting with [1/5] drm/i915/gt: Wait for new requests in intel_gt_retire_requests() (rev2) Patchwork
2019-11-15 17:18   ` [Intel-gfx] " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2019-11-14  9:13 [PATCH] drm/i915/selftests: Be explicit in ERR_PTR handling Chris Wilson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191115125543.856274-1-chris@chris-wilson.co.uk \
    --to=chris@chris-wilson.co.uk \
    --cc=dan.carpenter@oracle.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.