2013-04-24 02:44:12

by Wei Yongjun

[permalink] [raw]
Subject: [PATCH -next v2] gpu: host1x: gr2d: fix error return code in gr2d_submit()

From: Wei Yongjun <[email protected]>

Fix to return -EINVAL in the host1x_bo lookup error handling
case instead of 0, as done elsewhere in this function.

Signed-off-by: Wei Yongjun <[email protected]>
---
v1 -> v2: fix the patch subject
---
drivers/gpu/host1x/drm/gr2d.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/host1x/drm/gr2d.c b/drivers/gpu/host1x/drm/gr2d.c
index 6a45ae0..146cd64 100644
--- a/drivers/gpu/host1x/drm/gr2d.c
+++ b/drivers/gpu/host1x/drm/gr2d.c
@@ -135,8 +135,10 @@ static int gr2d_submit(struct host1x_drm_context *context,
goto fail;

bo = host1x_bo_lookup(drm, file, cmdbuf.handle);
- if (!bo)
+ if (!bo) {
+ err = -EINVAL;
goto fail;
+ }

host1x_job_add_gather(job, bo, cmdbuf.words, cmdbuf.offset);
num_cmdbufs--;
@@ -158,8 +160,10 @@ static int gr2d_submit(struct host1x_drm_context *context,
reloc->cmdbuf = cmdbuf;
reloc->target = target;

- if (!reloc->target || !reloc->cmdbuf)
+ if (!reloc->target || !reloc->cmdbuf) {
+ err = -EINVAL;
goto fail;
+ }
}

err = copy_from_user(job->waitchk, waitchks,


2013-04-24 06:44:14

by Thierry Reding

[permalink] [raw]
Subject: Re: [PATCH -next v2] gpu: host1x: gr2d: fix error return code in gr2d_submit()

On Wed, Apr 24, 2013 at 10:44:08AM +0800, Wei Yongjun wrote:
> From: Wei Yongjun <[email protected]>
>
> Fix to return -EINVAL in the host1x_bo lookup error handling
> case instead of 0, as done elsewhere in this function.

So with my comment to v1 addressed this becomes invalid again. I think
in both cases using -ENOENT is a better choice. Pretty much any instance
where drm_gem_object_lookup() fails is handled by returning -ENOENT, so
we should do the same in this driver for consistency.

Thierry


Attachments:
(No filename) (516.00 B)
(No filename) (836.00 B)
Download all attachments