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.
This commit is contained in:
Markus Armbruster 2010-02-18 11:49:42 +01:00
parent 8631b6084a
commit a44264880e
1 changed files with 1 additions and 1 deletions

View File

@ -535,7 +535,7 @@ static int usb_msd_initfn(USBDevice *dev)
usb_msd_handle_reset(dev); usb_msd_handle_reset(dev);
if (bdrv_key_required(s->conf.dinfo->bdrv)) { 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, monitor_read_bdrv_key_start(cur_mon, s->conf.dinfo->bdrv,
usb_msd_password_cb, s); usb_msd_password_cb, s);
s->dev.auto_attach = 0; s->dev.auto_attach = 0;