diff options
Diffstat (limited to 'hw/block/m25p80.c')
-rw-r--r-- | hw/block/m25p80.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c index 8c3b7f0d3b..02a15441fa 100644 --- a/hw/block/m25p80.c +++ b/hw/block/m25p80.c @@ -624,6 +624,11 @@ static int m25p80_init(SSISlave *ss) if (dinfo && dinfo->bdrv) { DB_PRINT_L(0, "Binding to IF_MTD drive\n"); s->bdrv = dinfo->bdrv; + if (bdrv_is_read_only(s->bdrv)) { + fprintf(stderr, "Can't use a read-only drive"); + return 1; + } + /* FIXME: Move to late init */ if (bdrv_read(s->bdrv, 0, s->storage, DIV_ROUND_UP(s->size, BDRV_SECTOR_SIZE))) { |