Commit 1c238a95 authored by Jaehoon Chung's avatar Jaehoon Chung Committed by Ulf Hansson

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: default avatarJaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent df9bcc2b
...@@ -1536,7 +1536,8 @@ static int dw_mci_get_cd(struct mmc_host *mmc) ...@@ -1536,7 +1536,8 @@ static int dw_mci_get_cd(struct mmc_host *mmc)
spin_lock_bh(&host->lock); spin_lock_bh(&host->lock);
if (present && !test_and_set_bit(DW_MMC_CARD_PRESENT, &slot->flags)) if (present && !test_and_set_bit(DW_MMC_CARD_PRESENT, &slot->flags))
dev_dbg(&mmc->class_dev, "card is present\n"); 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"); dev_dbg(&mmc->class_dev, "card is not present\n");
spin_unlock_bh(&host->lock); spin_unlock_bh(&host->lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment