summaryrefslogtreecommitdiff
path: root/common/cmd_mmc.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/cmd_mmc.c')
-rw-r--r--common/cmd_mmc.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c
index 7dacd5114c..8c53a10315 100644
--- a/common/cmd_mmc.c
+++ b/common/cmd_mmc.c
@@ -282,6 +282,13 @@ static int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
mmc_init(mmc);
+ if ((state == MMC_WRITE || state == MMC_ERASE)) {
+ if (mmc_getwp(mmc) == 1) {
+ printf("Error: card is write protected!\n");
+ return 1;
+ }
+ }
+
switch (state) {
case MMC_READ:
n = mmc->block_dev.block_read(curr_device, blk,