video: tegra: hdmi: cleanup error handling in init
Gaurav Batra [Wed, 1 Aug 2012 19:28:51 +0000 (12:28 -0700)]
In case tegra_dc_init fails, this change will prevent unbalanced call
to dc->out_ops->disable().

Also mark tegra_dc_io_end in case tegra_dc_controller_enable
fails, this is required to not stop device from going into suspend mode.

Bug 1003874

Change-Id: I5af6b46fc50e1ae8e54f9f4eb8540d751364fed7
Signed-off-by: Gaurav Batra <gbatra@nvidia.com>
Reviewed-on: http://git-master/r/120108
(cherry picked from commit 7f72709c2f23c05f65ff4ca8bfecde0db1448a65)
Reviewed-on: http://git-master/r/120959
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Pradeep Thiruchelvam <pradeept@nvidia.com>
GVS: Gerrit_Virtual_Submit

drivers/video/tegra/dc/dc.c

index a856691..db97ed3 100644 (file)
@@ -1299,14 +1299,18 @@ static bool _tegra_dc_controller_enable(struct tegra_dc *dc)
        tegra_dc_clk_enable(dc);
 
        /* do not accept interrupts during initialization */
-       tegra_dc_writel(dc, 0, DC_CMD_INT_ENABLE);
        tegra_dc_writel(dc, 0, DC_CMD_INT_MASK);
 
        enable_dc_irq(dc->irq);
 
        failed_init = tegra_dc_init(dc);
        if (failed_init) {
-               _tegra_dc_controller_disable(dc);
+               tegra_dc_writel(dc, 0, DC_CMD_INT_MASK);
+               disable_irq(dc->irq);
+               tegra_dc_clear_bandwidth(dc);
+               tegra_dc_clk_disable(dc);
+               if (dc->out && dc->out->disable)
+                       dc->out->disable();
                return false;
        }
 
@@ -1427,7 +1431,11 @@ static bool _tegra_dc_enable(struct tegra_dc *dc)
 
        tegra_dc_io_start(dc);
 
-       return _tegra_dc_controller_enable(dc);
+       if (!_tegra_dc_controller_enable(dc)) {
+               tegra_dc_io_end(dc);
+               return false;
+       }
+       return true;
 }
 
 void tegra_dc_enable(struct tegra_dc *dc)