[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 11/37] hw/usb-storage: Check whether BB is inserted
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 11/37] hw/usb-storage: Check whether BB is inserted |
Date: |
Fri, 23 Oct 2015 19:00:58 +0200 |
From: Max Reitz <address@hidden>
Only call bdrv_add_key() on the BlockDriverState if it is not NULL.
Signed-off-by: Max Reitz <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Alberto Garcia <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
hw/usb/dev-storage.c | 30 ++++++++++++++++--------------
1 file changed, 16 insertions(+), 14 deletions(-)
diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c
index 9a4e7dc..597d8fd 100644
--- a/hw/usb/dev-storage.c
+++ b/hw/usb/dev-storage.c
@@ -613,20 +613,22 @@ static void usb_msd_realize_storage(USBDevice *dev, Error
**errp)
return;
}
- bdrv_add_key(blk_bs(blk), NULL, &err);
- if (err) {
- if (monitor_cur_is_qmp()) {
- error_propagate(errp, err);
- return;
- }
- error_free(err);
- err = NULL;
- if (cur_mon) {
- monitor_read_bdrv_key_start(cur_mon, blk_bs(blk),
- usb_msd_password_cb, s);
- s->dev.auto_attach = 0;
- } else {
- autostart = 0;
+ if (blk_bs(blk)) {
+ bdrv_add_key(blk_bs(blk), NULL, &err);
+ if (err) {
+ if (monitor_cur_is_qmp()) {
+ error_propagate(errp, err);
+ return;
+ }
+ error_free(err);
+ err = NULL;
+ if (cur_mon) {
+ monitor_read_bdrv_key_start(cur_mon, blk_bs(blk),
+ usb_msd_password_cb, s);
+ s->dev.auto_attach = 0;
+ } else {
+ autostart = 0;
+ }
}
}
--
1.8.3.1
- [Qemu-block] [PULL 00/37] Block layer patches, Kevin Wolf, 2015/10/23
- [Qemu-block] [PULL 01/37] block: Remove host floppy support, Kevin Wolf, 2015/10/23
- [Qemu-block] [PULL 03/37] blockdev: Allow creation of BDS trees without BB, Kevin Wolf, 2015/10/23
- [Qemu-block] [PULL 02/37] block: Set BDRV_O_INCOMING in bdrv_fill_options(), Kevin Wolf, 2015/10/23
- [Qemu-block] [PULL 05/37] block: Make bdrv_is_inserted() return a bool, Kevin Wolf, 2015/10/23
- [Qemu-block] [PULL 06/37] block: Add blk_is_available(), Kevin Wolf, 2015/10/23
- [Qemu-block] [PULL 04/37] iotests: Only create BB if necessary, Kevin Wolf, 2015/10/23
- [Qemu-block] [PULL 08/37] block/raw_bsd: Drop raw_is_inserted(), Kevin Wolf, 2015/10/23
- [Qemu-block] [PULL 07/37] block: Make bdrv_is_inserted() recursive, Kevin Wolf, 2015/10/23
- [Qemu-block] [PULL 09/37] block: Invoke change media CB before NULLing drv, Kevin Wolf, 2015/10/23
- [Qemu-block] [PULL 11/37] hw/usb-storage: Check whether BB is inserted,
Kevin Wolf <=
- [Qemu-block] [PULL 10/37] hw/block/fdc: Implement tray status, Kevin Wolf, 2015/10/23
- [Qemu-block] [PULL 12/37] block: Fix BB AIOCB AioContext without BDS, Kevin Wolf, 2015/10/23
- [Qemu-block] [PULL 13/37] block: Move guest_block_size into BlockBackend, Kevin Wolf, 2015/10/23
- [Qemu-block] [PULL 18/37] block: Add BlockBackendRootState, Kevin Wolf, 2015/10/23
- [Qemu-block] [PULL 14/37] block: Remove wr_highest_sector from BlockAcctStats, Kevin Wolf, 2015/10/23
- [Qemu-block] [PULL 17/37] block/throttle-groups: Make incref/decref public, Kevin Wolf, 2015/10/23
- [Qemu-block] [PULL 15/37] block: Move BlockAcctStats into BlockBackend, Kevin Wolf, 2015/10/23
- [Qemu-block] [PULL 21/37] block: Prepare remaining BB functions for NULL BDS, Kevin Wolf, 2015/10/23
- [Qemu-block] [PULL 16/37] block: Move I/O status and error actions into BB, Kevin Wolf, 2015/10/23
- [Qemu-block] [PULL 22/37] block: Add blk_insert_bs(), Kevin Wolf, 2015/10/23