summaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorJaehoon Chung <jh80.chung@samsung.com>2016-11-24 12:04:40 +0100
committerUlf Hansson <ulf.hansson@linaro.org>2016-12-05 10:31:15 +0100
commit1c238a95a727e8cd3fe1c97a653c4101b8dd39d2 (patch)
tree95a504281a44f72750cf011bf69c22212bb70df1 /drivers/mmc
parentmmc: dw_mmc: add missing codes for runtime resume (diff)
downloadlinux-1c238a95a727e8cd3fe1c97a653c4101b8dd39d2.tar.xz
linux-1c238a95a727e8cd3fe1c97a653c4101b8dd39d2.zip
mmc: dw_mmc: check the "present" variable before checking flags
Before checking flags, it has to check "present" variable. Otherwise, flags should be cleared everytime. Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/host/dw_mmc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 0aa4bcd85bb7..c0e96ade4cc9 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -1536,7 +1536,8 @@ static int dw_mci_get_cd(struct mmc_host *mmc)
spin_lock_bh(&host->lock);
if (present && !test_and_set_bit(DW_MMC_CARD_PRESENT, &slot->flags))
dev_dbg(&mmc->class_dev, "card is present\n");
- else if (!test_and_clear_bit(DW_MMC_CARD_PRESENT, &slot->flags))
+ else if (!present &&
+ !test_and_clear_bit(DW_MMC_CARD_PRESENT, &slot->flags))
dev_dbg(&mmc->class_dev, "card is not present\n");
spin_unlock_bh(&host->lock);