diff mbox

block: Don't call blk_bs() twice in bdrv_lookup_bs()

Message ID 1445870809-29468-1-git-send-email-berto@igalia.com
State New
Headers show

Commit Message

Alberto Garcia Oct. 26, 2015, 2:46 p.m. UTC
Signed-off-by: Alberto Garcia <berto@igalia.com>
---
 block.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Kevin Wolf Oct. 26, 2015, 4:26 p.m. UTC | #1
Am 26.10.2015 um 15:46 hat Alberto Garcia geschrieben:
> Signed-off-by: Alberto Garcia <berto@igalia.com>

Thanks, applied to the block branch.

Kevin
diff mbox

Patch

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