From patchwork Wed Jun 14 23:18:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 9787761 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 3CB73602CB for ; Thu, 15 Jun 2017 01:00:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3280F284F5 for ; Thu, 15 Jun 2017 01:00:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 27521284F8; Thu, 15 Jun 2017 01:00:02 +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=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID 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 5A4AC284F5 for ; Thu, 15 Jun 2017 01:00:01 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CE1B26E65F; Thu, 15 Jun 2017 00:57:55 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf0-x244.google.com (mail-lf0-x244.google.com [IPv6:2a00:1450:4010:c07::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1F6456E632 for ; Wed, 14 Jun 2017 23:19:07 +0000 (UTC) Received: by mail-lf0-x244.google.com with SMTP id u62so1617573lfg.0 for ; Wed, 14 Jun 2017 16:19:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=Pj0wY+4Bh/VB0fVNrnmw3lnqQrWYXTHmH034fBP1TIo=; b=OlDd+mYjf/UqSj2EtVNG8QC28pYPOFKejUacwx79g08pf5N30C+dUF/kKGiqxDMT8r 6ksBPU4yKxE7dCHcFtLWN3qMD9psgavQ0UOrHEcMfPdFtDhBfv1zlzA0tpIf2KmVlrAB 4qUPTV63t1xs3FZV0shTyAakManKArbmJooeOIa/P/0I0XLd4pBUhr4qB4Onc8x0ZdaY 6vus+S4lDHk3XHtsW1jAYln3bzdRKKETPH9IgGGg3KY8J+H8bfUE509FnkYh4uyXebxj LbMVPdM/XrmCVstT1wnNU5dE8J88/GKSCztjYc5tLhJ8lxzRfI5zzRsR1L/mQLrKKUkj ceTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=Pj0wY+4Bh/VB0fVNrnmw3lnqQrWYXTHmH034fBP1TIo=; b=Z49KHJ5WBH6ceBecJ2Rh/8FcS41pk5qmIfD4CKtyXorVsdwFegbD3P5rLufc7xEJpx WleRPqCvn67CSIGDHD8l4laGF8x4aypNLMgapbNUuGFDF9o07YsGUzrTfqoCzxkjYWs6 tmIQWm511OzZaLNtA3f5DXr5P5Lxl/pRS7sfhf2JuPadRZ33nyOUN6KMMr4xkt2kVbEX yxTJAiMU9LACX9YBWnaYfubI6XI3kqE+vlydBCnYUqE3X7UUmWfwxyToVO1kIXLdSFGA M6s40RjFatXkANxU9//Jz+mqgCeWtrm8SSAeGNyaZn45fa6DUCu+g81yOSCyQekwzvgR Z8bA== X-Gm-Message-State: AKS2vOzisULk/YqMHZFYSdQtQr858/zAUBDqkoV+HNGQ1auRVc5PO43/ TwzjNawjAsTxuA== X-Received: by 10.25.227.66 with SMTP id c2mr865948lfk.22.1497482345614; Wed, 14 Jun 2017 16:19:05 -0700 (PDT) Received: from localhost.localdomain (ppp109-252-91-7.pppoe.spdop.ru. [109.252.91.7]) by smtp.gmail.com with ESMTPSA id i24sm290165ljb.63.2017.06.14.16.19.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Jun 2017 16:19:05 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Mikko Perttunen , Erik Faye-Lund Subject: [PATCH v3 10/20] gpu: host1x: Correct host1x_job_pin() error handling Date: Thu, 15 Jun 2017 02:18:33 +0300 Message-Id: X-Mailer: git-send-email 2.13.0 In-Reply-To: References: In-Reply-To: References: X-Mailman-Approved-At: Thu, 15 Jun 2017 00:57:20 +0000 Cc: linux-tegra@vger.kernel.org, DRI Development 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 In case of relocations / waitchecks patching failure the jobs pins stay referenced till DRM file get closed, wasting memory. Add the missed unpinning. Signed-off-by: Dmitry Osipenko Reviewed-by: Erik Faye-Lund Reviewed-by: Mikko Perttunen --- drivers/gpu/host1x/job.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/host1x/job.c b/drivers/gpu/host1x/job.c index d9933828fe87..14f3f957ffab 100644 --- a/drivers/gpu/host1x/job.c +++ b/drivers/gpu/host1x/job.c @@ -592,22 +592,20 @@ int host1x_job_pin(struct host1x_job *job, struct device *dev) err = do_relocs(job, g->bo); if (err) - break; + goto out; err = do_waitchks(job, host, g->bo); if (err) - break; + goto out; } - if (IS_ENABLED(CONFIG_TEGRA_HOST1X_FIREWALL) && !err) { - err = copy_gathers(job, dev); - if (err) { - host1x_job_unpin(job); - return err; - } - } + if (!IS_ENABLED(CONFIG_TEGRA_HOST1X_FIREWALL)) + goto out; + err = copy_gathers(job, dev); out: + if (err) + host1x_job_unpin(job); wmb(); return err;