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>
This commit is contained in:
Alberto Garcia 2015-10-26 16:46:49 +02:00 committed by Kevin Wolf
parent 3c07587d49
commit 9f4ed6fbd2

View File

@ -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;
}
}