@@ -1400,7 +1400,7 @@ void mmc_rescan(struct work_struct *work
int err;
unsigned long flags;
int i;
- unsigned freqs[] = { 400000, 300000, 200000, 100000 };
+ const unsigned freqs[] = { 400000, 300000, 200000, 100000 };
spin_lock_irqsave(&host->lock, flags);
@@ -1445,12 +1445,15 @@ void mmc_rescan(struct work_struct *work
if (freqs[i] >= host->f_min)
host->f_init = freqs[i];
- else if (i && freqs[i-1] <= host->f_min)
- goto out;
- else
+ else if (!i || freqs[i-1] > host->f_min)
host->f_init = host->f_min;
+ else {
+ mmc_release_host(host);
+ goto out;
+ }
+ pr_info("%s: %s: trying to init card at %u Hz\n",
+ mmc_hostname(host), __func__, host->f_init);
- printk ("mmc_rescan: trying %u Hz\n", host->f_init);
mmc_power_up(host);
sdio_reset(host);
mmc_go_idle(host);
@@ -1464,7 +1467,10 @@ void mmc_rescan(struct work_struct *work
if (!err) {
if (mmc_attach_sdio(host, ocr)) {
mmc_claim_host(host);
- /* try SDMEM (but not MMC) even if SDIO is broken */
+ /*
+ * Try SDMEM (but not MMC) even if SDIO
+ * is broken.
+ */
if (mmc_send_app_op_cond(host, 0, &ocr))
goto out_fail;