From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:48298) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPbTh-00017o-Gd for qemu-devel@nongnu.org; Tue, 09 Apr 2013 12:33:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UPbTg-0004uI-9h for qemu-devel@nongnu.org; Tue, 09 Apr 2013 12:33:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:27450) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPbTg-0004uE-1R for qemu-devel@nongnu.org; Tue, 09 Apr 2013 12:33:00 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r39GWxOD016276 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 9 Apr 2013 12:32:59 -0400 From: Markus Armbruster References: Date: Tue, 09 Apr 2013 18:32:57 +0200 In-Reply-To: (Pavel Hrdina's message of "Fri, 29 Mar 2013 15:12:37 +0100") Message-ID: <87mwt74qbq.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v4 10/11] savevm: update return value from qemu_savevm_state List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Pavel Hrdina Cc: qemu-devel@nongnu.org, lcapitulino@redhat.com Pavel Hrdina writes: > Signed-off-by: Pavel Hrdina > Reviewed-by: Eric Blake > --- > savevm.c | 9 ++++----- > 1 file changed, 4 insertions(+), 5 deletions(-) > > diff --git a/savevm.c b/savevm.c > index 6ac4ece..75f64d1 100644 > --- a/savevm.c > +++ b/savevm.c > @@ -1910,7 +1910,7 @@ void qemu_savevm_state_cancel(void) > } > } > > -static int qemu_savevm_state(QEMUFile *f, Error **errp) > +static void qemu_savevm_state(QEMUFile *f, Error **errp) > { > int ret; > MigrationParams params = { > @@ -1919,7 +1919,7 @@ static int qemu_savevm_state(QEMUFile *f, Error **errp) > }; > > if (qemu_savevm_state_blocked(errp)) { > - return -EINVAL; > + return; > } > > qemu_mutex_unlock_iothread(); > @@ -1940,7 +1940,6 @@ static int qemu_savevm_state(QEMUFile *f, Error **errp) ret = qemu_file_get_error(f); if (ret == 0) { qemu_savevm_state_complete(f, errp); ret = qemu_file_get_error(f); } > if (ret != 0) { > qemu_savevm_state_cancel(); > } > - return ret; > } > Could be simplified to: if (!qemu_file_get_error(f)) { qemu_savevm_state_complete(f, errp); } if (qemu_file_get_error(f)) { qemu_savevm_state_cancel(); } > static int qemu_save_device_state(QEMUFile *f) > @@ -2327,10 +2326,10 @@ SnapshotInfo *qmp_vm_snapshot_save(bool has_name, const char *name, > error_setg(errp, "failed to open '%s' file", bdrv_get_device_name(bs)); > goto the_end; > } > - ret = qemu_savevm_state(f, &local_err); > + qemu_savevm_state(f, &local_err); > vm_state_size = qemu_ftell(f); > qemu_fclose(f); > - if (ret < 0) { > + if (error_is_set(&local_err)) { > error_propagate(errp, local_err); > goto the_end; > }