summaryrefslogtreecommitdiffstats
path: root/block.c
diff options
context:
space:
mode:
authorAlberto Garcia2015-10-26 15:46:49 +0100
committerKevin Wolf2015-11-11 16:22:46 +0100
commit9f4ed6fbd264a7c097590d830dcfd93996a80acb (patch)
tree3068941508fac59b2bf25e14689deb758efd618a /block.c
parentMerge remote-tracking branch 'remotes/dgibson/tags/ppc-next-20151111' into st... (diff)
downloadqemu-9f4ed6fbd264a7c097590d830dcfd93996a80acb.tar.gz
qemu-9f4ed6fbd264a7c097590d830dcfd93996a80acb.tar.xz
qemu-9f4ed6fbd264a7c097590d830dcfd93996a80acb.zip
block: Don't call blk_bs() twice in bdrv_lookup_bs()
Signed-off-by: Alberto Garcia <berto@igalia.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block.c')
-rw-r--r--block.c6
1 files changed, 3 insertions, 3 deletions
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;
}
}