From patchwork Mon Dec 12 19:41:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Padovan X-Patchwork-Id: 9471129 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4BB9C60476 for ; Mon, 12 Dec 2016 19:41:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 33B0F284AB for ; Mon, 12 Dec 2016 19:41:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 28138284D4; Mon, 12 Dec 2016 19:41:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.7 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 34353284AB for ; Mon, 12 Dec 2016 19:41:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 427766E3EE; Mon, 12 Dec 2016 19:41:18 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ua0-f194.google.com (mail-ua0-f194.google.com [209.85.217.194]) by gabe.freedesktop.org (Postfix) with ESMTPS id D66016E3ED; Mon, 12 Dec 2016 19:41:15 +0000 (UTC) Received: by mail-ua0-f194.google.com with SMTP id 50so9647975uae.2; Mon, 12 Dec 2016 11:41:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=68NwTQJ1XQavhAJe39+zi9Nlo8KDfkaWonI64NWe7bo=; b=kZAP+RNKmKktbU7HFro3D3C9brOpJ0OxArHk0sxsJOFs2L0T/7+Pcg9O9+dbXJM1K8 bx6yG1wgB/jF44SWNGfDAJJtMgqoodlCmr9ZnAnvGWo13AkGBOdXPVG6J3pEPjlfW69z krUY6KPHlSiH/Az4K9G+6qGAdTO0CyaFSw5kptfRRMkcq5La9cxUfFSrJVklPJYbdH3s CT0JwtbHu1UA0j+beNxUO7NVaZEwf0faaWviiSq8nGwhgXKFWoXZHyrsJSlJJ5ztnXjQ 0feRAisPZ+ru60oJZ08M1/Rhn4T6/pVK7piKjaqGJCeRhGQl6IkhZxKrw91+Pa7jBWGw 7Dqg== X-Gm-Message-State: AKaTC00XCQpp0g5HeY8+ZnRAUBT/kYsrvzpLGSY4/szZ2rpMT4kQcj8CoLFiQ6W6uyuoRw== X-Received: by 10.159.49.89 with SMTP id n25mr77235488uab.79.1481571674852; Mon, 12 Dec 2016 11:41:14 -0800 (PST) Received: from jade.localdomain ([187.64.235.185]) by smtp.gmail.com with ESMTPSA id e34sm12086006uae.1.2016.12.12.11.41.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Dec 2016 11:41:14 -0800 (PST) From: Gustavo Padovan To: dri-devel@lists.freedesktop.org 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 Cc: Gustavo Padovan , "open list:DRM DRIVER FOR MSM ADRENO GPU" , open list , "open list:DRM DRIVER FOR MSM ADRENO GPU" X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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;