Received: from eggs.gnu.org ([2001:4830:134:3::10]:49197) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zqj3K-000590-2u for qemu-devel@nongnu.org; Mon, 26 Oct 2015 10:47:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zqj3F-0007eo-Uw for qemu-devel@nongnu.org; Mon, 26 Oct 2015 10:47:14 -0400 From: Alberto Garcia Date: Mon, 26 Oct 2015 16:46:49 +0200 Message-Id: <1445870809-29468-1-git-send-email-berto@igalia.com> Subject: [Qemu-devel] [PATCH] block: Don't call blk_bs() twice in bdrv_lookup_bs() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Alberto Garcia , Stefan Hajnoczi , qemu-block@nongnu.org, Max Reitz Signed-off-by: Alberto Garcia --- block.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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; } } -- 2.6.1