Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 06d9f32f authored by Asutosh Das's avatar Asutosh Das Committed by Xiaonian Wang
Browse files

mmc: sdhci: finish the request if sdhc is in bad state



In the current code, if sdhci_check_state returns true a tasklet is
scheduled which doesn't complete the request if host->mrq is NULL,
which is the case, if sdhci is in bad state. This would make the
mmcqd thread wait for completion infinitely.
Hence, complete the request if sdhci_check_state returns true instead
of scheduling the tasklet.

CRs-Fixed: 615537
Change-Id: I8e2950c3999ac3806f9d631c52d86f0dc13b992f
Signed-off-by: default avatarAsutosh Das <asutoshd@codeaurora.org>
[xiaonian@codeaurora.org: fix trivial merge conflict]
Signed-off-by: default avatarXiaonian Wang <xiaonian@codeaurora.org>
parent 23dd7f88
Loading
Loading
Loading
Loading
+17 −1
Original line number Diff line number Diff line
@@ -50,6 +50,15 @@ static bool sdhci_check_state(struct sdhci_host *);

static void sdhci_enable_preset_value(struct sdhci_host *host, bool enable);

#ifdef CONFIG_PM
static int sdhci_runtime_pm_put(struct sdhci_host *host);
#else
static inline int sdhci_runtime_pm_put(struct sdhci_host *host)
{
	return 0;
}
#endif

static void sdhci_dump_state(struct sdhci_host *host)
{
	struct mmc_host *mmc = host->mmc;
@@ -1702,7 +1711,8 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq)
		mrq->cmd->error = -EIO;
		if (mrq->data)
			mrq->data->error = -EIO;
		tasklet_schedule(&host->finish_tasklet);
		mmc_request_done(host->mmc, mrq);
		sdhci_runtime_pm_put(host);
		return;
	}

@@ -3228,6 +3238,12 @@ int sdhci_resume_host(struct sdhci_host *host)

EXPORT_SYMBOL_GPL(sdhci_resume_host);

static int sdhci_runtime_pm_put(struct sdhci_host *host)
{
	pm_runtime_mark_last_busy(host->mmc->parent);
	return pm_runtime_put_autosuspend(host->mmc->parent);
}

int sdhci_runtime_suspend_host(struct sdhci_host *host)
{
	unsigned long flags;