From: Alberto Garcia Date: Mon, 26 Oct 2015 14:46:49 +0000 (+0200) Subject: block: Don't call blk_bs() twice in bdrv_lookup_bs() X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=9f4ed6fbd264a7c097590d830dcfd93996a80acb;p=qmiga%2Fqemu.git block: Don't call blk_bs() twice in bdrv_lookup_bs() Signed-off-by: Alberto Garcia Signed-off-by: Kevin Wolf --- diff --git a/block.c b/block.c index e9f40dc768..eb8158ac33 100644 --- a/block.c +++ b/block.c @@ -2683,12 +2683,12 @@ BlockDriverState *bdrv_lookup_bs(const char *device, blk = blk_by_name(device); if (blk) { - if (!blk_bs(blk)) { + bs = blk_bs(blk); + if (!bs) { error_setg(errp, "Device '%s' has no medium", device); - return NULL; } - return blk_bs(blk); + return bs; } }