Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752728AbcLLTlR (ORCPT ); Mon, 12 Dec 2016 14:41:17 -0500 Received: from mail-ua0-f196.google.com ([209.85.217.196]:36788 "EHLO mail-ua0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751983AbcLLTlP (ORCPT ); Mon, 12 Dec 2016 14:41:15 -0500 From: Gustavo Padovan To: dri-devel@lists.freedesktop.org Cc: Gustavo Padovan , Rob Clark , David Airlie , 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 Message-Id: <1481571668-14094-1-git-send-email-gustavo@padovan.org> X-Mailer: git-send-email 2.5.5 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1173 Lines: 39 From: Gustavo Padovan 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 --- 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