From patchwork Tue Jun 13 23:15:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 9785101 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 9837760384 for ; Wed, 14 Jun 2017 00:44:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8B2E928584 for ; Wed, 14 Jun 2017 00:44:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8018228589; Wed, 14 Jun 2017 00:44:03 +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 0E9EA28584 for ; Wed, 14 Jun 2017 00:44:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D89FA6E414; Wed, 14 Jun 2017 00:41:49 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf0-x241.google.com (mail-lf0-x241.google.com [IPv6:2a00:1450:4010:c07::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0B6BB6E3D4 for ; Tue, 13 Jun 2017 23:38:57 +0000 (UTC) Received: by mail-lf0-x241.google.com with SMTP id x81so14865401lfb.3 for ; Tue, 13 Jun 2017 16:38:56 -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=gPFp28g1m2YlZ18DgjrA4pwEXfTXJApb129LhxZFfZ16a+hjnXLOrEck6siqjvh/6T yPYOgxZib6qrTmnPdki7njMhJ29Kgk07dSuvvW+wESEW2B2DA51RJJCWSt2WgOeYpRxl O0gwslN0dJvJmhqMf0XY4v6rBXhAUQWE2G1qbGTIf7Ryowz9jl/IkN7tfEHSI6FNTjtr Va8r5QnxcRV/zsv1U/jnsi+5YyG1X2WyMDnnZJD1KoFMJSRoTRBt5fhNdQqJ8s05tl4+ K7LjFvoRggT2vIi2rwitajLO5EwnyQ5UCOQqNV6DMoiC5lw+LTFfi6lOzYz6I+WcrVzN pyRQ== 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=Ufv89ZBIvnxzjZZ33PfU6rT2zIu7iig5K/V+DiRyIUyjhg5mhC8jWjfMbcFzx1uCaj ChZJ1jvdi5rQbP7WLQRsF20SDgB3x3qLN9PisUDODSUZD+ms+UfPXU4GEgTpj0Ec3fjH ehknDqq3SwyMrjR5avNFVW7BVuHgUuiR4mlLF5kWXDm/8dA1cTfgYwUvi3a52ngw0QEB DiVBb3ekNA4Q/ECFFq7eXXBANPy8BPVqwrH9KcRzqXWXC2JwqrjAHPZZkBQhxK0JBKGq l0QW1o3fBvUrxGLidCNct4dM8cjVssEFpxCYC6lga1p5pTiqb2AK8I6MPQHLeheRlk/j 1taw== X-Gm-Message-State: AKS2vOxWCbw+eGTumF/Wra3nyLV7rYpMq9sj+UX9pev6LL8a3UkpSSV8 Xcvle4Jb49GVRg== X-Received: by 10.46.9.146 with SMTP id 140mr803546ljj.42.1497397135523; Tue, 13 Jun 2017 16:38:55 -0700 (PDT) Received: from localhost.localdomain (ppp109-252-91-7.pppoe.spdop.ru. [109.252.91.7]) by smtp.gmail.com with ESMTPSA id f27sm3785725lfa.27.2017.06.13.16.38.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Jun 2017 16:38:54 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Mikko Perttunen , Erik Faye-Lund Subject: [PATCH v2 12/22] gpu: host1x: Correct host1x_job_pin() error handling Date: Wed, 14 Jun 2017 02:15:51 +0300 Message-Id: X-Mailer: git-send-email 2.13.0 In-Reply-To: References: In-Reply-To: References: X-Mailman-Approved-At: Wed, 14 Jun 2017 00:41:00 +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;