提交 b793f658 编写于 作者: D Doug Anderson 提交者: Ulf Hansson

mmc: dw_mmc: Don't try to enable the CD until we're sure we're not deferring

If dw_mci_init_slot() returns that we got a probe deferral then it may
leave slot->mmc as NULL.  That will cause dw_mci_enable_cd() to crash
when it calls mmc_gpio_get_cd().

Fix this by moving the call of dw_mci_enable_cd() until we're sure
that we're good.  Note that if we have more than one slot and one
defers (but the others don't) things won't work so well.  ...but
that's not a new thing and everyone has already agreed that multislot
support ought to be removed from dw_mmc eventually anyway since it is
unused, untested, and you can see several bugs like this by inspecting
the code.

Fixes: bcafaf5470f0 ("mmc: dw_mmc: Only enable CD after setup and only if needed")
Signed-off-by: NDoug Anderson <dianders@chromium.org>
Signed-off-by: NJaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
上级 5c935165
......@@ -2890,9 +2890,6 @@ int dw_mci_probe(struct dw_mci *host)
init_slots++;
}
/* Now that slots are all setup, we can enable card detect */
dw_mci_enable_cd(host);
if (init_slots) {
dev_info(host->dev, "%d slots initialized\n", init_slots);
} else {
......@@ -2901,6 +2898,9 @@ int dw_mci_probe(struct dw_mci *host)
goto err_dmaunmap;
}
/* Now that slots are all setup, we can enable card detect */
dw_mci_enable_cd(host);
if (host->quirks & DW_MCI_QUIRK_IDMAC_DTO)
dev_info(host->dev, "Internal DMAC interrupt fix enabled.\n");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册