OSDN Git Service

block: Don't call blk_bs() twice in bdrv_lookup_bs()
authorAlberto Garcia <berto@igalia.com>
Mon, 26 Oct 2015 14:46:49 +0000 (16:46 +0200)
committerKevin Wolf <kwolf@redhat.com>
Wed, 11 Nov 2015 15:22:46 +0000 (16:22 +0100)
Signed-off-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block.c

diff --git a/block.c b/block.c
index e9f40dc..eb8158a 100644 (file)
--- 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;
         }
     }