aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2011-12-03 02:28:05 -0500
committerChris Ball <cjb@laptop.org>2012-01-11 23:58:43 -0500
commitb678b91f22debd5f8efa04895652989004761d06 (patch)
tree36ee5bf832d4d8ea039fad3e652e1f6afc4b371d
parentadd710eaa88606de8ba98a014d37178579e6dbaf (diff)
mmc: sdhci-pci: simplify error handling
Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Chris Ball <cjb@laptop.org>
-rw-r--r--drivers/mmc/host/sdhci-pci.c38
1 files changed, 18 insertions, 20 deletions
diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c
index 6878a94626bc..d2e77fb21b26 100644
--- a/drivers/mmc/host/sdhci-pci.c
+++ b/drivers/mmc/host/sdhci-pci.c
@@ -1012,11 +1012,8 @@ static int sdhci_pci_suspend(struct device *dev)
1012 1012
1013 ret = sdhci_suspend_host(slot->host); 1013 ret = sdhci_suspend_host(slot->host);
1014 1014
1015 if (ret) { 1015 if (ret)
1016 for (i--; i >= 0; i--) 1016 goto err_pci_suspend;
1017 sdhci_resume_host(chip->slots[i]->host);
1018 return ret;
1019 }
1020 1017
1021 slot_pm_flags = slot->host->mmc->pm_flags; 1018 slot_pm_flags = slot->host->mmc->pm_flags;
1022 if (slot_pm_flags & MMC_PM_WAKE_SDIO_IRQ) 1019 if (slot_pm_flags & MMC_PM_WAKE_SDIO_IRQ)
@@ -1027,11 +1024,8 @@ static int sdhci_pci_suspend(struct device *dev)
1027 1024
1028 if (chip->fixes && chip->fixes->suspend) { 1025 if (chip->fixes && chip->fixes->suspend) {
1029 ret = chip->fixes->suspend(chip); 1026 ret = chip->fixes->suspend(chip);
1030 if (ret) { 1027 if (ret)
1031 for (i = chip->num_slots - 1; i >= 0; i--) 1028 goto err_pci_suspend;
1032 sdhci_resume_host(chip->slots[i]->host);
1033 return ret;
1034 }
1035 } 1029 }
1036 1030
1037 pci_save_state(pdev); 1031 pci_save_state(pdev);
@@ -1048,6 +1042,11 @@ static int sdhci_pci_suspend(struct device *dev)
1048 } 1042 }
1049 1043
1050 return 0; 1044 return 0;
1045
1046err_pci_suspend:
1047 while (--i >= 0)
1048 sdhci_resume_host(chip->slots[i]->host);
1049 return ret;
1051} 1050}
1052 1051
1053static int sdhci_pci_resume(struct device *dev) 1052static int sdhci_pci_resume(struct device *dev)
@@ -1113,23 +1112,22 @@ static int sdhci_pci_runtime_suspend(struct device *dev)
1113 1112
1114 ret = sdhci_runtime_suspend_host(slot->host); 1113 ret = sdhci_runtime_suspend_host(slot->host);
1115 1114
1116 if (ret) { 1115 if (ret)
1117 for (i--; i >= 0; i--) 1116 goto err_pci_runtime_suspend;
1118 sdhci_runtime_resume_host(chip->slots[i]->host);
1119 return ret;
1120 }
1121 } 1117 }
1122 1118
1123 if (chip->fixes && chip->fixes->suspend) { 1119 if (chip->fixes && chip->fixes->suspend) {
1124 ret = chip->fixes->suspend(chip); 1120 ret = chip->fixes->suspend(chip);
1125 if (ret) { 1121 if (ret)
1126 for (i = chip->num_slots - 1; i >= 0; i--) 1122 goto err_pci_runtime_suspend;
1127 sdhci_runtime_resume_host(chip->slots[i]->host);
1128 return ret;
1129 }
1130 } 1123 }
1131 1124
1132 return 0; 1125 return 0;
1126
1127err_pci_runtime_suspend:
1128 while (--i >= 0)
1129 sdhci_runtime_resume_host(chip->slots[i]->host);
1130 return ret;
1133} 1131}
1134 1132
1135static int sdhci_pci_runtime_resume(struct device *dev) 1133static int sdhci_pci_runtime_resume(struct device *dev)