aboutsummaryrefslogtreecommitdiff
path: root/hw/usb-msd.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2010-02-18 11:49:42 +0100
committerMarkus Armbruster <armbru@redhat.com>2010-03-16 16:55:05 +0100
commita44264880ef42254edb88f9ec5d6f35e3e84089b (patch)
treec65e90b4e4608f5cdcb098b1f22b673edf309b7c /hw/usb-msd.c
parent8631b6084a13e712ae8356d779077991aba010a5 (diff)
block: Simplify usb_msd_initfn() test for "can read bdrv key"
The old test assumes that "hotplugged" implies "we have a current monitor for reading the key". This is in fact true, but it's not obviously true. Aside: if it were false, we could pass a null pointer to monitor_read_bdrv_key_start(), which would then crash. The previous commit permits us to check for "we have a current monitor" directly, so do that.
Diffstat (limited to 'hw/usb-msd.c')
-rw-r--r--hw/usb-msd.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/usb-msd.c b/hw/usb-msd.c
index 1a11bc557e..0afb03133c 100644
--- a/hw/usb-msd.c
+++ b/hw/usb-msd.c
@@ -535,7 +535,7 @@ static int usb_msd_initfn(USBDevice *dev)
usb_msd_handle_reset(dev);
if (bdrv_key_required(s->conf.dinfo->bdrv)) {
- if (s->dev.qdev.hotplugged) {
+ if (cur_mon) {
monitor_read_bdrv_key_start(cur_mon, s->conf.dinfo->bdrv,
usb_msd_password_cb, s);
s->dev.auto_attach = 0;