From ee9cabbf6941e005fe42b73057051c4f300a9c02 Mon Sep 17 00:00:00 2001
From: Mikhail Lappo <mikhail.lappo@esrlabs.com>
Date: Tue, 4 Dec 2018 09:30:03 +0100
Subject: [PATCH] mmc: Add missing ifdef

Fix build when CONFIG_MMC_WRITE is not
defined. The struct field erase_grp_size
is under the same ifdef

Signed-off-by: Mikhail Lappo <mikhail.lappo@esrlabs.com>
---
 drivers/mmc/mmc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index d6b9cdc..3bf3d63 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -1066,9 +1066,11 @@ int mmc_hwpart_config(struct mmc *mmc,
 
 		ext_csd[EXT_CSD_ERASE_GROUP_DEF] = 1;
 
+#if CONFIG_IS_ENABLED(MMC_WRITE)
 		/* update erase group size to be high-capacity */
 		mmc->erase_grp_size =
 			ext_csd[EXT_CSD_HC_ERASE_GRP_SIZE] * 1024;
+#endif
 
 	}
 
-- 
2.7.4

