msm: footswitch-8x60: Properly cleanup when bus port halt fails
Clocks are left on when bus port halting fails. Restore the
clocks to their previous behavior before returning from the
footswitch routines when bus port opertaions fail.
Change-Id: I04a316c3c0a4531658bbcc1b318d3f426bdbdc65
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
diff --git a/arch/arm/mach-msm/footswitch-8x60.c b/arch/arm/mach-msm/footswitch-8x60.c
index a8e2449..5006419 100644
--- a/arch/arm/mach-msm/footswitch-8x60.c
+++ b/arch/arm/mach-msm/footswitch-8x60.c
@@ -151,21 +151,21 @@
/* Make sure required clocks are on at the correct rates. */
rc = setup_clocks(fs);
if (rc)
- goto out;
+ return rc;
/* Un-halt all bus ports in the power domain. */
if (fs->bus_port1) {
rc = msm_bus_axi_portunhalt(fs->bus_port1);
if (rc) {
pr_err("%s: Port 1 unhalt failed.\n", __func__);
- goto out;
+ goto err;
}
}
if (fs->bus_port2) {
rc = msm_bus_axi_portunhalt(fs->bus_port2);
if (rc) {
pr_err("%s: Port 2 unhalt failed.\n", __func__);
- goto out;
+ goto err_port2_halt;
}
}
@@ -209,7 +209,12 @@
restore_clocks(fs);
fs->is_enabled = true;
-out:
+ return 0;
+
+err_port2_halt:
+ msm_bus_axi_porthalt(fs->bus_port1);
+err:
+ restore_clocks(fs);
return rc;
}
@@ -226,14 +231,14 @@
/* Make sure required clocks are on at the correct rates. */
rc = setup_clocks(fs);
if (rc)
- goto out;
+ return rc;
/* Halt all bus ports in the power domain. */
if (fs->bus_port1) {
rc = msm_bus_axi_porthalt(fs->bus_port1);
if (rc) {
pr_err("%s: Port 1 halt failed.\n", __func__);
- goto out;
+ goto err;
}
}
if (fs->bus_port2) {
@@ -275,12 +280,12 @@
writel_relaxed(regval, fs->gfs_ctl_reg);
fs->is_enabled = false;
-
- return rc;
+ return 0;
err_port2_halt:
msm_bus_axi_portunhalt(fs->bus_port1);
-out:
+err:
+ restore_clocks(fs);
return rc;
}
@@ -301,14 +306,14 @@
/* Make sure required clocks are on at the correct rates. */
rc = setup_clocks(fs);
if (rc)
- goto out;
+ return rc;
/* Un-halt all bus ports in the power domain. */
if (fs->bus_port1) {
rc = msm_bus_axi_portunhalt(fs->bus_port1);
if (rc) {
pr_err("%s: Port 1 unhalt failed.\n", __func__);
- goto out;
+ goto err;
}
}
@@ -351,7 +356,10 @@
restore_clocks(fs);
fs->is_enabled = true;
-out:
+ return 0;
+
+err:
+ restore_clocks(fs);
return rc;
}
@@ -368,14 +376,14 @@
/* Make sure required clocks are on at the correct rates. */
rc = setup_clocks(fs);
if (rc)
- goto out;
+ return rc;
/* Halt all bus ports in the power domain. */
if (fs->bus_port1) {
rc = msm_bus_axi_porthalt(fs->bus_port1);
if (rc) {
pr_err("%s: Port 1 halt failed.\n", __func__);
- goto out;
+ goto err;
}
}
@@ -411,8 +419,10 @@
restore_clocks(fs);
fs->is_enabled = false;
+ return 0;
-out:
+err:
+ restore_clocks(fs);
return rc;
}