From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50448) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0FPw-0008JJ-H3 for qemu-devel@nongnu.org; Wed, 03 Jun 2015 16:37:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z0FPv-0002sI-JD for qemu-devel@nongnu.org; Wed, 03 Jun 2015 16:37:40 -0400 Message-ID: <556F658D.9000609@redhat.com> Date: Wed, 03 Jun 2015 14:37:33 -0600 From: Eric Blake MIME-Version: 1.0 References: <1433360659-1915-1-git-send-email-mreitz@redhat.com> <1433360659-1915-11-git-send-email-mreitz@redhat.com> In-Reply-To: <1433360659-1915-11-git-send-email-mreitz@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="hLXHSfETlNUttc3QTaK2LOC6qcWxDVKVp" Subject: Re: [Qemu-devel] [PATCH v3 10/38] hw/usb-storage: Check whether BB is inserted List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz , qemu-block@nongnu.org Cc: Kevin Wolf , John Snow , qemu-devel@nongnu.org, Stefan Hajnoczi , Markus Armbruster This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --hLXHSfETlNUttc3QTaK2LOC6qcWxDVKVp Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 06/03/2015 01:43 PM, Max Reitz wrote: > Only call bdrv_add_key() on the BlockDriverState if it is not NULL. >=20 > Signed-off-by: Max Reitz > --- > hw/usb/dev-storage.c | 30 ++++++++++++++++-------------- > 1 file changed, 16 insertions(+), 14 deletions(-) >=20 > diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c > index abe0e1d..5b1dc90 100644 > --- a/hw/usb/dev-storage.c > +++ b/hw/usb/dev-storage.c > @@ -612,20 +612,22 @@ static void usb_msd_realize_storage(USBDevice *de= v, Error **errp) > return; > } > =20 > - bdrv_add_key(blk_bs(blk), NULL, &err); > - if (err) { > - if (monitor_cur_is_qmp()) { > - error_propagate(errp, err); > - return; > - } > - error_free(err); > - err =3D NULL; > - if (cur_mon) { > - monitor_read_bdrv_key_start(cur_mon, blk_bs(blk), > - usb_msd_password_cb, s); > - s->dev.auto_attach =3D 0; > - } else { > - autostart =3D 0; > + if (blk_bs(blk)) { > + bdrv_add_key(blk_bs(blk), NULL, &err); > + if (err) { > + if (monitor_cur_is_qmp()) { Hopefully doesn't conflict with Markus' work to refactor error handling here (https://lists.gnu.org/archive/html/qemu-devel/2015-06/msg00431.html= ) Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --hLXHSfETlNUttc3QTaK2LOC6qcWxDVKVp Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJVb2WNAAoJEKeha0olJ0Nq6a8H/3uL9CCtGA9fL9Fluw1bnJD8 NI0/aJlDp0RnU9kDawvm8eRCfksneuzu+VKMuAwhCur+URPoW+KVRVjl9K8ki8uK w8n/LmLtjFPrOAkMxySaBp2ftYWatMWzzY0vYd9hxnxsnSodHj/b+p9jZ5sIVV8p CkTIaz+af6/hv4CPc/ytINaoR7hJ6DC+bDzB1ie0zUe8yPIajTVXBgShH9NgcFwP hWdXTKlrCB1CM7iXUPs9SfvYVOtgnAiGIwdAMZ5t9IPV7Rn7NvklYDi6QAgQ9K25 rvxFMars6mmPMC1Eer8fti61/s8TBnAklGV5lqJvU3sxY2fEhDgqcGhzWR2JBS4= =DDkB -----END PGP SIGNATURE----- --hLXHSfETlNUttc3QTaK2LOC6qcWxDVKVp--