aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorJean-Jacques Hiblot2017-11-30 17:43:58 +0100
committerJaehoon Chung2018-01-12 18:11:04 +0900
commit1de06b9fa5871b75012307ea736c8a43edf5a888 (patch)
treeb469ffe717befa61963e7c952566184eb9f98c89 /drivers
parent1da8eb598fb7fd631483a7db0a42d5de286f98a5 (diff)
mmc: fix for old MMCs (below version 4)
The ext_csd is allocated only for MMC above version 4. The compare will crash or fail for older MMCs. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mmc/mmc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 0ebcc455166..2a58031c198 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -1657,6 +1657,9 @@ static int mmc_read_and_compare_ext_csd(struct mmc *mmc)
const u8 *ext_csd = mmc->ext_csd;
ALLOC_CACHE_ALIGN_BUFFER(u8, test_csd, MMC_MAX_BLOCK_LEN);
+ if (mmc->version < MMC_VERSION_4)
+ return 0;
+
err = mmc_send_ext_csd(mmc, test_csd);
if (err)
return err;