Commit b678b91f authored by Axel Lin's avatar Axel Lin Committed by Chris Ball

mmc: sdhci-pci: simplify error handling

Signed-off-by: default avatarAxel Lin <axel.lin@gmail.com>
Acked-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
Signed-off-by: default avatarChris Ball <cjb@laptop.org>
parent add710ea
...@@ -1012,11 +1012,8 @@ static int sdhci_pci_suspend(struct device *dev) ...@@ -1012,11 +1012,8 @@ static int sdhci_pci_suspend(struct device *dev)
ret = sdhci_suspend_host(slot->host); ret = sdhci_suspend_host(slot->host);
if (ret) { if (ret)
for (i--; i >= 0; i--) goto err_pci_suspend;
sdhci_resume_host(chip->slots[i]->host);
return ret;
}
slot_pm_flags = slot->host->mmc->pm_flags; slot_pm_flags = slot->host->mmc->pm_flags;
if (slot_pm_flags & MMC_PM_WAKE_SDIO_IRQ) if (slot_pm_flags & MMC_PM_WAKE_SDIO_IRQ)
...@@ -1027,11 +1024,8 @@ static int sdhci_pci_suspend(struct device *dev) ...@@ -1027,11 +1024,8 @@ static int sdhci_pci_suspend(struct device *dev)
if (chip->fixes && chip->fixes->suspend) { if (chip->fixes && chip->fixes->suspend) {
ret = chip->fixes->suspend(chip); ret = chip->fixes->suspend(chip);
if (ret) { if (ret)
for (i = chip->num_slots - 1; i >= 0; i--) goto err_pci_suspend;
sdhci_resume_host(chip->slots[i]->host);
return ret;
}
} }
pci_save_state(pdev); pci_save_state(pdev);
...@@ -1048,6 +1042,11 @@ static int sdhci_pci_suspend(struct device *dev) ...@@ -1048,6 +1042,11 @@ static int sdhci_pci_suspend(struct device *dev)
} }
return 0; return 0;
err_pci_suspend:
while (--i >= 0)
sdhci_resume_host(chip->slots[i]->host);
return ret;
} }
static int sdhci_pci_resume(struct device *dev) static int sdhci_pci_resume(struct device *dev)
...@@ -1113,23 +1112,22 @@ static int sdhci_pci_runtime_suspend(struct device *dev) ...@@ -1113,23 +1112,22 @@ static int sdhci_pci_runtime_suspend(struct device *dev)
ret = sdhci_runtime_suspend_host(slot->host); ret = sdhci_runtime_suspend_host(slot->host);
if (ret) { if (ret)
for (i--; i >= 0; i--) goto err_pci_runtime_suspend;
sdhci_runtime_resume_host(chip->slots[i]->host);
return ret;
}
} }
if (chip->fixes && chip->fixes->suspend) { if (chip->fixes && chip->fixes->suspend) {
ret = chip->fixes->suspend(chip); ret = chip->fixes->suspend(chip);
if (ret) { if (ret)
for (i = chip->num_slots - 1; i >= 0; i--) goto err_pci_runtime_suspend;
sdhci_runtime_resume_host(chip->slots[i]->host);
return ret;
}
} }
return 0; return 0;
err_pci_runtime_suspend:
while (--i >= 0)
sdhci_runtime_resume_host(chip->slots[i]->host);
return ret;
} }
static int sdhci_pci_runtime_resume(struct device *dev) static int sdhci_pci_runtime_resume(struct device *dev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment