All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gustavo Padovan <gustavo@padovan.org>
To: dri-devel@lists.freedesktop.org
Cc: Gustavo Padovan <gustavo.padovan@collabora.co.uk>,
	Rob Clark <robdclark@gmail.com>, David Airlie <airlied@linux.ie>,
	"open list:DRM DRIVER FOR MSM ADRENO GPU"
	<linux-arm-msm@vger.kernel.org>,
	"open list:DRM DRIVER FOR MSM ADRENO GPU"
	<freedreno@lists.freedesktop.org>,
	open list <linux-kernel@vger.kernel.org>
Subject: [PATCH] drm/msm: return fence_fd = -1 if gem_submit fails
Date: Mon, 12 Dec 2016 17:41:08 -0200	[thread overview]
Message-ID: <1481571668-14094-1-git-send-email-gustavo@padovan.org> (raw)

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

Previously we were returning garbage here, fix it by setting it to -1
before the first possible point of failure.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/gpu/drm/msm/msm_gem_submit.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c b/drivers/gpu/drm/msm/msm_gem_submit.c
index 166e84e..c102b55 100644
--- a/drivers/gpu/drm/msm/msm_gem_submit.c
+++ b/drivers/gpu/drm/msm/msm_gem_submit.c
@@ -383,10 +383,13 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
 	struct msm_gpu *gpu = priv->gpu;
 	struct dma_fence *in_fence = NULL;
 	struct sync_file *sync_file = NULL;
+	int in_fence_fd = args->fence_fd;
 	int out_fence_fd = -1;
 	unsigned i;
 	int ret;
 
+	args->fence_fd = -1;
+
 	if (!gpu)
 		return -ENXIO;
 
@@ -427,7 +430,7 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
 		goto out;
 
 	if (args->flags & MSM_SUBMIT_FENCE_FD_IN) {
-		in_fence = sync_file_get_fence(args->fence_fd);
+		in_fence = sync_file_get_fence(in_fence_fd);
 
 		if (!in_fence) {
 			ret = -EINVAL;
-- 
2.5.5

WARNING: multiple messages have this Message-ID (diff)
From: Gustavo Padovan <gustavo@padovan.org>
To: dri-devel@lists.freedesktop.org
Cc: Gustavo Padovan <gustavo.padovan@collabora.co.uk>,
	Rob Clark <robdclark@gmail.com>, David Airlie <airlied@linux.ie>,
	linux-arm-msm@vger.kernel.org (open list:DRM DRIVER FOR MSM
	ADRENO GPU),
	freedreno@lists.freedesktop.org (open list:DRM DRIVER FOR MSM
	ADRENO GPU), linux-kernel@vger.kernel.org (open list)
Subject: [PATCH] drm/msm: return fence_fd = -1 if gem_submit fails
Date: Mon, 12 Dec 2016 17:41:08 -0200	[thread overview]
Message-ID: <1481571668-14094-1-git-send-email-gustavo@padovan.org> (raw)

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

Previously we were returning garbage here, fix it by setting it to -1
before the first possible point of failure.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/gpu/drm/msm/msm_gem_submit.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c b/drivers/gpu/drm/msm/msm_gem_submit.c
index 166e84e..c102b55 100644
--- a/drivers/gpu/drm/msm/msm_gem_submit.c
+++ b/drivers/gpu/drm/msm/msm_gem_submit.c
@@ -383,10 +383,13 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
 	struct msm_gpu *gpu = priv->gpu;
 	struct dma_fence *in_fence = NULL;
 	struct sync_file *sync_file = NULL;
+	int in_fence_fd = args->fence_fd;
 	int out_fence_fd = -1;
 	unsigned i;
 	int ret;
 
+	args->fence_fd = -1;
+
 	if (!gpu)
 		return -ENXIO;
 
@@ -427,7 +430,7 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
 		goto out;
 
 	if (args->flags & MSM_SUBMIT_FENCE_FD_IN) {
-		in_fence = sync_file_get_fence(args->fence_fd);
+		in_fence = sync_file_get_fence(in_fence_fd);
 
 		if (!in_fence) {
 			ret = -EINVAL;
-- 
2.5.5

             reply	other threads:[~2016-12-12 19:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-12 19:41 Gustavo Padovan [this message]
2016-12-12 19:41 ` [PATCH] drm/msm: return fence_fd = -1 if gem_submit fails Gustavo Padovan
     [not found] ` <1481571668-14094-1-git-send-email-gustavo-THi1TnShQwVAfugRpC6u6w@public.gmane.org>
2016-12-12 20:42   ` Chris Wilson
2016-12-12 20:42     ` Chris Wilson
2016-12-12 21:23     ` Gustavo Padovan
2016-12-12 21:23       ` Gustavo Padovan

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=1481571668-14094-1-git-send-email-gustavo@padovan.org \
    --to=gustavo@padovan.org \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=gustavo.padovan@collabora.co.uk \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robdclark@gmail.com \
    /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.