From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54546) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wfr2G-00087l-7X for qemu-devel@nongnu.org; Thu, 01 May 2014 09:28:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wfr27-0007Ea-3x for qemu-devel@nongnu.org; Thu, 01 May 2014 09:28:24 -0400 Message-ID: <53624BEB.7030605@gmail.com> Date: Thu, 01 May 2014 21:28:11 +0800 From: Chen Gang MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH] arch_init: Be sure of only one exit entry with DPRINTF() for ram_load() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: quintela@redhat.com, owasserm@redhat.com, pbonzini@redhat.com, mst@redhat.com, Eric Blake Cc: QEMU Trivial , QEMU Developers When DPRINTF() has effect, the original author wants to print all ram_load() calling results. So need use 'goto' instead of 'return' within ram_load(), just like other areas have done. Signed-off-by: Chen Gang --- arch_init.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/arch_init.c b/arch_init.c index 60c975d..333f698 100644 --- a/arch_init.c +++ b/arch_init.c @@ -998,7 +998,8 @@ static int ram_load(QEMUFile *f, void *opaque, int version_id) seq_iter++; if (version_id < 4 || version_id > 4) { - return -EINVAL; + ret = -EINVAL; + goto done; } do { @@ -1055,7 +1056,8 @@ static int ram_load(QEMUFile *f, void *opaque, int version_id) host = host_from_stream_offset(f, addr, flags); if (!host) { - return -EINVAL; + ret = -EINVAL; + goto done; } ch = qemu_get_byte(f); @@ -1065,14 +1067,16 @@ static int ram_load(QEMUFile *f, void *opaque, int version_id) host = host_from_stream_offset(f, addr, flags); if (!host) { - return -EINVAL; + ret = -EINVAL; + goto done; } qemu_get_buffer(f, host, TARGET_PAGE_SIZE); } else if (flags & RAM_SAVE_FLAG_XBZRLE) { void *host = host_from_stream_offset(f, addr, flags); if (!host) { - return -EINVAL; + ret = -EINVAL; + goto done; } if (load_xbzrle(f, addr, host) < 0) { -- 1.7.11.7