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: 9471127 X-Patchwork-Delegate: agross@codeaurora.org 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 2DD2660476 for ; Mon, 12 Dec 2016 19:41:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 14A04284AB for ; Mon, 12 Dec 2016 19:41:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 080FC284D4; Mon, 12 Dec 2016 19:41:18 +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=-6.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7FC45284AB for ; Mon, 12 Dec 2016 19:41:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752088AbcLLTlQ (ORCPT ); Mon, 12 Dec 2016 14:41:16 -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 Received: by mail-ua0-f196.google.com with SMTP id 12so9596817uas.3; 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=Gv1zHPNgaSlhXNLFgTbMgPx6VJ7JVO76VFlL2HX34a+QOue/ETvnSpA/FBtlnqUgv3 Q4e6qSn/6gD2HvSCYqay4CAGOkHrJaT6WbuCfTwf0EgaQ9oSUf+bhSw5PxhsLBhK6C+n 9CA/DvL2HsktACAPtZmOinXqEX9St32AFpUuwb1e/MqjWKpKcVESVr2i3mjZf/lhjhyj NlZ9lhzG4DBPqlIi94/iez1vHVGm2BbdlQKmUtyDVMQ9lmagerz5ROChXaATBi4TSjG3 MyiBiR8b4zzzEpTru50M2aqCT4Eq6b+d99/fVf0tK+x8+bHY4XAChqtCip/thg1Gcc4+ 3Qog== X-Gm-Message-State: AKaTC01PiOwFdaYrWt2Da1ZZWvzT3IDOvoES6ia+Uh85cqbR+hNgTH/wKWSUpKyCMdjHRg== 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 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-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 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;