diff mbox

drm/i915/selftest: Fix dma_buf_vmap error handling

Message ID 20170517124149.8622-1-mika.kuoppala@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Mika Kuoppala May 17, 2017, 12:41 p.m. UTC
The dma_buf_vmap in itself warns on error and then downgrades
the return value from error ptr to NULL. Don't try to decode error
value from the return in our test.

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
---
 drivers/gpu/drm/i915/selftests/i915_gem_dmabuf.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Chris Wilson May 17, 2017, 12:54 p.m. UTC | #1
On Wed, May 17, 2017 at 03:41:49PM +0300, Mika Kuoppala wrote:
> The dma_buf_vmap in itself warns on error and then downgrades
> the return value from error ptr to NULL. Don't try to decode error
> value from the return in our test.
> 

Actually dma_buf_vmap shouldn't be WARNing here, so go fix that instead.
-Chris
Mika Kuoppala May 17, 2017, 2:49 p.m. UTC | #2
Chris Wilson <chris@chris-wilson.co.uk> writes:

> On Wed, May 17, 2017 at 03:41:49PM +0300, Mika Kuoppala wrote:
>> The dma_buf_vmap in itself warns on error and then downgrades
>> the return value from error ptr to NULL. Don't try to decode error
>> value from the return in our test.
>> 
>
> Actually dma_buf_vmap shouldn't be WARNing here, so go fix that
> instead.

Regarless of warn, we have mixed use of null and errptr checks
in the test. So eventually it might be best to return errptr
from dma_buf_vmap along of fixing the WARN.

But as discussed in irc, this might not bring much value.
-Mika
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_dmabuf.c b/drivers/gpu/drm/i915/selftests/i915_gem_dmabuf.c
index d15cc9d3a5cd..89dc25a5a53b 100644
--- a/drivers/gpu/drm/i915/selftests/i915_gem_dmabuf.c
+++ b/drivers/gpu/drm/i915/selftests/i915_gem_dmabuf.c
@@ -246,9 +246,9 @@  static int igt_dmabuf_export_vmap(void *arg)
 	i915_gem_object_put(obj);
 
 	ptr = dma_buf_vmap(dmabuf);
-	if (IS_ERR(ptr)) {
-		err = PTR_ERR(ptr);
-		pr_err("dma_buf_vmap failed with err=%d\n", err);
+	if (!ptr) {
+		pr_err("dma_buf_vmap failed\n");
+		err = -ENOMEM;
 		goto out;
 	}