From patchwork Tue Oct 8 06:27:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arto Merilainen X-Patchwork-Id: 3000901 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0BE269F243 for ; Tue, 8 Oct 2013 06:35:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0BE1B2017E for ; Tue, 8 Oct 2013 06:35:17 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 6216120176 for ; Tue, 8 Oct 2013 06:35:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9350EE67A5 for ; Mon, 7 Oct 2013 23:35:12 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from hqemgate16.nvidia.com (hqemgate16.nvidia.com [216.228.121.65]) by gabe.freedesktop.org (Postfix) with ESMTP id ED8C3E6900 for ; Mon, 7 Oct 2013 23:31:49 -0700 (PDT) Received: from hqnvupgp08.nvidia.com (Not Verified[216.228.121.13]) by hqemgate16.nvidia.com id ; Mon, 07 Oct 2013 23:31:48 -0700 Received: from hqemhub03.nvidia.com ([172.20.12.94]) by hqnvupgp08.nvidia.com (PGP Universal service); Mon, 07 Oct 2013 23:27:42 -0700 X-PGP-Universal: processed; by hqnvupgp08.nvidia.com on Mon, 07 Oct 2013 23:27:42 -0700 Received: from amerilainen-lnx.Nvidia.com (172.20.144.16) by hqemhub03.nvidia.com (172.20.150.15) with Microsoft SMTP Server (TLS) id 8.3.327.1; Mon, 7 Oct 2013 23:31:49 -0700 From: Arto Merilainen To: , Subject: [PATCHv4 1/5] drm/tegra: Fix gr2d initialisation clean up Date: Tue, 8 Oct 2013 09:27:24 +0300 Message-ID: <1381213648-5931-2-git-send-email-amerilainen@nvidia.com> X-Mailer: git-send-email 1.8.1.5 In-Reply-To: <1381213648-5931-1-git-send-email-amerilainen@nvidia.com> References: <1381213648-5931-1-git-send-email-amerilainen@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 Cc: linux-tegra@vger.kernel.org, mkulkarni@nvidia.com, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amerilainen@nvidia.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP gr2d initialisation clean up had missing steps (i.e. host1x channel was not released if we could not register gr2d as a host1x client) that could have lead to weird issues. This patch reworks the initialisation sequence to do clean up correctly. Signed-off-by: Arto Merilainen --- drivers/gpu/host1x/drm/gr2d.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/host1x/drm/gr2d.c b/drivers/gpu/host1x/drm/gr2d.c index 27ffcf1..60150ad 100644 --- a/drivers/gpu/host1x/drm/gr2d.c +++ b/drivers/gpu/host1x/drm/gr2d.c @@ -282,13 +282,15 @@ static int gr2d_probe(struct platform_device *pdev) } gr2d->channel = host1x_channel_request(dev); - if (!gr2d->channel) - return -ENOMEM; + if (!gr2d->channel) { + err = -ENOMEM; + goto err_channel_request; + } *syncpts = host1x_syncpt_request(dev, false); if (!(*syncpts)) { - host1x_channel_free(gr2d->channel); - return -ENOMEM; + err = -ENOMEM; + goto err_syncpt_request; } gr2d->client.ops = &gr2d_client_ops; @@ -300,7 +302,7 @@ static int gr2d_probe(struct platform_device *pdev) err = host1x_register_client(host1x, &gr2d->client); if (err < 0) { dev_err(dev, "failed to register host1x client: %d\n", err); - return err; + goto err_register_client; } gr2d_init_addr_reg_map(dev, gr2d); @@ -308,6 +310,15 @@ static int gr2d_probe(struct platform_device *pdev) platform_set_drvdata(pdev, gr2d); return 0; + +err_register_client: + host1x_syncpt_free(*gr2d->client.syncpts); +err_syncpt_request: + host1x_channel_free(gr2d->channel); +err_channel_request: + clk_disable_unprepare(gr2d->clk); + + return err; } static int __exit gr2d_remove(struct platform_device *pdev)