[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH RFC 09/48] block: Simplify usb_msd_initfn() test for

From: Markus Armbruster
Subject: [Qemu-devel] [PATCH RFC 09/48] block: Simplify usb_msd_initfn() test for "can read bdrv key"
Date: Wed, 24 Feb 2010 18:55:21 +0100

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.

Signed-off-by: Markus Armbruster <address@hidden>
 hw/usb-msd.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/hw/usb-msd.c b/hw/usb-msd.c
index 36991f8..1e3e101 100644
--- a/hw/usb-msd.c
+++ b/hw/usb-msd.c
@@ -535,7 +535,7 @@ static int usb_msd_initfn(USBDevice *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;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]