diff mbox

[-next] drm/tegra: fix the error handling in tegra_dc_probe()

Message ID CAPgLHd8M+8pqRRidRTQM0aP1xb7mT_Fxqzu4pw-Sb5UGpMYr7g@mail.gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Wei Yongjun Dec. 14, 2013, 2:29 p.m. UTC
From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

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 <yongjun_wei@trendmicro.com.cn>
---
 drivers/gpu/drm/tegra/dc.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)
diff mbox

Patch

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)