From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:41343) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UUIz7-0006g3-Ke for qemu-devel@nongnu.org; Mon, 22 Apr 2013 11:48:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UUIz2-0001Lx-RY for qemu-devel@nongnu.org; Mon, 22 Apr 2013 11:48:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:12851) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UUIz2-0001Ll-K8 for qemu-devel@nongnu.org; Mon, 22 Apr 2013 11:48:48 -0400 From: Kevin Wolf Date: Mon, 22 Apr 2013 17:48:40 +0200 Message-Id: <1366645720-11384-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PATCH] block: Fix build with tracing enabled List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, anthony@codemonkey.ws, afaerber@suse.de, stefanha@redhat.com filename was still uninitialised when it's used as a parameter to a tracing function, so let's move the initialisation. Also, commit c2ad1b0c forgot to add a NULL check, which this patch adds while we're at it. Signed-off-by: Kevin Wolf --- block.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/block.c b/block.c index 819eb4e..aa9a533 100644 --- a/block.c +++ b/block.c @@ -676,7 +676,13 @@ static int bdrv_open_common(BlockDriverState *bs, BlockDriverState *file, assert(bs->file == NULL); assert(options != NULL && bs->options != options); - trace_bdrv_open_common(bs, filename, flags, drv->format_name); + if (file != NULL) { + filename = file->filename; + } else { + filename = qdict_get_try_str(options, "filename"); + } + + trace_bdrv_open_common(bs, filename ?: "", flags, drv->format_name); if (use_bdrv_whitelist && !bdrv_is_whitelisted(drv)) { return -ENOTSUP; @@ -698,12 +704,6 @@ static int bdrv_open_common(BlockDriverState *bs, BlockDriverState *file, bdrv_enable_copy_on_read(bs); } - if (file != NULL) { - filename = file->filename; - } else { - filename = qdict_get_try_str(options, "filename"); - } - if (filename != NULL) { pstrcpy(bs->filename, sizeof(bs->filename), filename); } else { -- 1.8.1.4