summary refs log tree commit diff stats
path: root/hw/sd/ssi-sd.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2013-09-13 15:51:47 +0200
committerKevin Wolf <kwolf@redhat.com>2013-10-11 16:50:01 +0200
commit4f8a066b5fc254eeaabbbde56ba4f5b29cc68fdf (patch)
treecaca58e5bd84ca7eaf74ed97b128ca966c29ba98 /hw/sd/ssi-sd.c
parent394c7d4d6bd06386308e2fef0cf1c613a10e0d23 (diff)
downloadfocaccia-qemu-4f8a066b5fc254eeaabbbde56ba4f5b29cc68fdf.tar.gz
focaccia-qemu-4f8a066b5fc254eeaabbbde56ba4f5b29cc68fdf.zip
blockdev: Remove IF_* check for read-only blockdev_init
IF_NONE allows read-only, which makes forbidding it in this place
for other types pretty much pointless.

Instead, make sure that all devices for which the check would have
errored out check in their init function that they don't get a read-only
BlockDriverState. This catches even cases where IF_NONE and -device is
used.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'hw/sd/ssi-sd.c')
-rw-r--r--hw/sd/ssi-sd.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/hw/sd/ssi-sd.c b/hw/sd/ssi-sd.c
index d47e2377f9..1bb56c4d54 100644
--- a/hw/sd/ssi-sd.c
+++ b/hw/sd/ssi-sd.c
@@ -246,6 +246,9 @@ static int ssi_sd_init(SSISlave *dev)
     s->mode = SSI_SD_CMD;
     dinfo = drive_get_next(IF_SD);
     s->sd = sd_init(dinfo ? dinfo->bdrv : NULL, true);
+    if (s->sd == NULL) {
+        return -1;
+    }
     register_savevm(&dev->qdev, "ssi_sd", -1, 1, ssi_sd_save, ssi_sd_load, s);
     return 0;
 }