diff options
author | Doug Anderson <dianders@chromium.org> | 2015-03-11 18:15:14 -0400 |
---|---|---|
committer | Ulf Hansson <ulf.hansson@linaro.org> | 2015-03-31 10:50:44 -0400 |
commit | b793f658b194edfe5e1d86aaeace01a7b03c68f9 (patch) | |
tree | 6c332ac668a559850ead4ce9d3cb92992159a606 | |
parent | 5c935165da79644df90a647ecc140fb77b40dee5 (diff) |
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: Doug Anderson <dianders@chromium.org>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
-rw-r--r-- | drivers/mmc/host/dw_mmc.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 8e0836d39081..3883fe6081da 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c | |||
@@ -2890,9 +2890,6 @@ int dw_mci_probe(struct dw_mci *host) | |||
2890 | init_slots++; | 2890 | init_slots++; |
2891 | } | 2891 | } |
2892 | 2892 | ||
2893 | /* Now that slots are all setup, we can enable card detect */ | ||
2894 | dw_mci_enable_cd(host); | ||
2895 | |||
2896 | if (init_slots) { | 2893 | if (init_slots) { |
2897 | dev_info(host->dev, "%d slots initialized\n", init_slots); | 2894 | dev_info(host->dev, "%d slots initialized\n", init_slots); |
2898 | } else { | 2895 | } else { |
@@ -2901,6 +2898,9 @@ int dw_mci_probe(struct dw_mci *host) | |||
2901 | goto err_dmaunmap; | 2898 | goto err_dmaunmap; |
2902 | } | 2899 | } |
2903 | 2900 | ||
2901 | /* Now that slots are all setup, we can enable card detect */ | ||
2902 | dw_mci_enable_cd(host); | ||
2903 | |||
2904 | if (host->quirks & DW_MCI_QUIRK_IDMAC_DTO) | 2904 | if (host->quirks & DW_MCI_QUIRK_IDMAC_DTO) |
2905 | dev_info(host->dev, "Internal DMAC interrupt fix enabled.\n"); | 2905 | dev_info(host->dev, "Internal DMAC interrupt fix enabled.\n"); |
2906 | 2906 | ||