devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] gpu: host1x: gr2d drivers/gpu/host1x/drm/gr2d.c: fix error return code in gr2d_submit()
@ 2013-04-24  2:19 Wei Yongjun
  2013-04-24  6:38 ` Thierry Reding
  0 siblings, 1 reply; 2+ messages in thread
From: Wei Yongjun @ 2013-04-24  2:19 UTC (permalink / raw)
  To: grant.likely-QSEj5FYQhm4dnm+yROfE0A,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ,
	thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB,
	tbergstrom-DDmLM1+adcrQT0dZR+AlfA,
	amerilainen-DDmLM1+adcrQT0dZR+AlfA
  Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	yongjun_wei-zrsr2BFq86L20UzCJQGyNP8+0UxHXcjY,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

From: Wei Yongjun <yongjun_wei-zrsr2BFq86L20UzCJQGyNP8+0UxHXcjY@public.gmane.org>

Fix to return a negative error code from the error handling
case instead of 0, as done elsewhere in this function.

Signed-off-by: Wei Yongjun <yongjun_wei-zrsr2BFq86L20UzCJQGyNP8+0UxHXcjY@public.gmane.org>
---
 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,

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

* Re: [PATCH -next] gpu: host1x: gr2d drivers/gpu/host1x/drm/gr2d.c: fix error return code in gr2d_submit()
  2013-04-24  2:19 [PATCH -next] gpu: host1x: gr2d drivers/gpu/host1x/drm/gr2d.c: fix error return code in gr2d_submit() Wei Yongjun
@ 2013-04-24  6:38 ` Thierry Reding
  0 siblings, 0 replies; 2+ messages in thread
From: Thierry Reding @ 2013-04-24  6:38 UTC (permalink / raw)
  To: Wei Yongjun
  Cc: grant.likely, rob.herring, tbergstrom, amerilainen, yongjun_wei,
	linux-kernel, devicetree-discuss

[-- Attachment #1: Type: text/plain, Size: 933 bytes --]

On Wed, Apr 24, 2013 at 10:19:27AM +0800, Wei Yongjun wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> 
> Fix to return a negative error code from the error handling
> case instead of 0, as done elsewhere in this function.
> 
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> ---
>  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;

I think in this case a better error code would be -ENOENT. Other than
that this patch looks good.

Thierry

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

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

end of thread, other threads:[~2013-04-24  6:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-24  2:19 [PATCH -next] gpu: host1x: gr2d drivers/gpu/host1x/drm/gr2d.c: fix error return code in gr2d_submit() Wei Yongjun
2013-04-24  6:38 ` Thierry Reding

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).