summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-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 7dacd5114ce..8c53a10315e 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,