From patchwork Sat Dec 14 14:29:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 3350701 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 893BC9F32E for ; Sun, 15 Dec 2013 17:49:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8D3CC20503 for ; Sun, 15 Dec 2013 17:49:30 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id A6D14203DB for ; Sun, 15 Dec 2013 17:49:27 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 51FCCFA372; Sun, 15 Dec 2013 09:49:22 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-bk0-f42.google.com (mail-bk0-f42.google.com [209.85.214.42]) by gabe.freedesktop.org (Postfix) with ESMTP id 7DE88FA707 for ; Sat, 14 Dec 2013 06:29:20 -0800 (PST) Received: by mail-bk0-f42.google.com with SMTP id w11so1804591bkz.1 for ; Sat, 14 Dec 2013 06:29:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:cc:content-type; bh=PToegqRTrNb+4/SDVI8tr7gD/3ePg988teL9Gs2SnI4=; b=xcMOGUkfXdZOJuwQkKcV97o8BXmYfFpj1kE68AzhZrcmlXGkaxLGstBn1D41zgL1rt +DvYzHjEcC8WENGrLBsB+D/gMLjNYsB6FtkX1WFRyknw6tSzV0YeItLGsqstE8IcFGaD zkOC80ADWCZXuxfi0nhdKhqU3OufjpFn0LhGCLQPDkIYd5IugN21ObuHAQEY+8XEJ9Cd RrTrvbZir4WxJErCas85AJRFfMyUmu7s/n010GSTerrCUsUlBb3S9Yhb6WIC8KSaed4m Ovj6fmAY7UArUqVW0GObf6aCT0q2RLXPqTgtJ3ogeCH+WvtAhM3WACn1JejrRhzdH76k DcSA== MIME-Version: 1.0 X-Received: by 10.204.167.141 with SMTP id q13mr2111092bky.2.1387031359181; Sat, 14 Dec 2013 06:29:19 -0800 (PST) Received: by 10.204.74.130 with HTTP; Sat, 14 Dec 2013 06:29:19 -0800 (PST) Date: Sat, 14 Dec 2013 22:29:19 +0800 Message-ID: Subject: [PATCH -next] drm/tegra: fix the error handling in tegra_dc_probe() From: Wei Yongjun To: thierry.reding@gmail.com, tbergstrom@nvidia.com, airlied@linux.ie, swarren@wwwdotorg.org, grant.likely@linaro.org, robh+dt@kernel.org X-Mailman-Approved-At: Sun, 15 Dec 2013 09:49:20 -0800 Cc: linux-tegra@vger.kernel.org, yongjun_wei@trendmicro.com.cn, dri-devel@lists.freedesktop.org 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@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 From: Wei Yongjun Add the missing clk_disable_unprepare() and tegra_dc_rgb_remove() before return from tegra_dc_probe() in the error handling case. Signed-off-by: Wei Yongjun --- drivers/gpu/drm/tegra/dc.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index cd7f1e4..4d93cf8 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -1199,13 +1199,16 @@ static int tegra_dc_probe(struct platform_device *pdev) regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); dc->regs = devm_ioremap_resource(&pdev->dev, regs); - if (IS_ERR(dc->regs)) - return PTR_ERR(dc->regs); + if (IS_ERR(dc->regs)) { + err = PTR_ERR(dc->regs); + goto err_clk_disable_unprepare; + } dc->irq = platform_get_irq(pdev, 0); if (dc->irq < 0) { dev_err(&pdev->dev, "failed to get IRQ\n"); - return -ENXIO; + err = -ENXIO; + goto err_clk_disable_unprepare; } INIT_LIST_HEAD(&dc->client.list); @@ -1215,19 +1218,24 @@ static int tegra_dc_probe(struct platform_device *pdev) err = tegra_dc_rgb_probe(dc); if (err < 0 && err != -ENODEV) { dev_err(&pdev->dev, "failed to probe RGB output: %d\n", err); - return err; + goto err_clk_disable_unprepare; } err = host1x_client_register(&dc->client); if (err < 0) { dev_err(&pdev->dev, "failed to register host1x client: %d\n", err); - return err; + goto err_rgb_remove; } platform_set_drvdata(pdev, dc); return 0; +err_rgb_remove: + tegra_dc_rgb_remove(dc); +err_clk_disable_unprepare: + clk_disable_unprepare(dc->clk); + return err; } static int tegra_dc_remove(struct platform_device *pdev)