From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49866) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xbsga-0000kj-TT for qemu-devel@nongnu.org; Wed, 08 Oct 2014 10:57:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XbsgW-0002Lo-J1 for qemu-devel@nongnu.org; Wed, 08 Oct 2014 10:57:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54026) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XbsgW-0002Li-Bq for qemu-devel@nongnu.org; Wed, 08 Oct 2014 10:57:48 -0400 Message-ID: <543550E5.1090707@redhat.com> Date: Wed, 08 Oct 2014 08:57:41 -0600 From: Eric Blake MIME-Version: 1.0 References: <1412068849-14848-1-git-send-email-zhang.zhanghailiang@huawei.com> <1412068849-14848-3-git-send-email-zhang.zhanghailiang@huawei.com> In-Reply-To: <1412068849-14848-3-git-send-email-zhang.zhanghailiang@huawei.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="7UdEQngBiljlgUPvSFAHaDTH4v0JUQ3jx" Subject: Re: [Qemu-devel] [PATCH v7 2/2] dump: Turn some functions to void to make code cleaner List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: zhanghailiang , qemu-devel@nongnu.org Cc: peter.huangpeng@huawei.com, luonengjun@huawei.com, armbru@redhat.com, lcapitulino@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --7UdEQngBiljlgUPvSFAHaDTH4v0JUQ3jx Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 09/30/2014 03:20 AM, zhanghailiang wrote: > Functions shouldn't return an error code and an Error object at the sam= e time. > Turn all these functions that returning Error object to void. > We also judge if a function success or fail by reference to the local_e= rr. >=20 > Signed-off-by: zhanghailiang > --- > dump.c | 313 ++++++++++++++++++++++++++++++---------------------------= -------- > 1 file changed, 143 insertions(+), 170 deletions(-) >=20 > @@ -348,49 +326,45 @@ static int write_elf_section(DumpState *s, int ty= pe, Error **errp) > ret =3D fd_write_vmcore(&shdr, shdr_size, s); > if (ret < 0) { > dump_error(s, "dump: failed to write section header table", er= rp); > - return -1; > + return; > } > - > - return 0; > } The 'return' here is not in a loop, and therefore not necessary. > =20 > -static int write_data(DumpState *s, void *buf, int length, Error **err= p) > +static void write_data(DumpState *s, void *buf, int length, Error **er= rp) > { > int ret; > =20 > ret =3D fd_write_vmcore(buf, length, s); > if (ret < 0) { > dump_error(s, "dump: failed to save memory", errp); > - return -1; > + return; > } > - > - return 0; > } and again. > =20 > /* write the memroy to vmcore. 1 page per I/O. */ Please s/memroy/memory/ while touching this :) > @@ -1706,7 +1680,6 @@ void qmp_dump_guest_memory(bool paging, const cha= r *file, bool has_begin, > } else { > create_vmcore(s, errp); > } > - > g_free(s); > } Looks a bit like a spurious line deletion in this hunk. Findings are minor, so I'm fine if you add: Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --7UdEQngBiljlgUPvSFAHaDTH4v0JUQ3jx Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg iQEcBAEBCAAGBQJUNVDlAAoJEKeha0olJ0NqvkQH/Ah62nfGN8jMbFDuGtzjzXrw K6YAGXn1bk7oL5ZxQdvSeTZIlghV/BDJ5vl1M/e61nmCbDilghBpOy1o47VUQzO7 gUy8gLgVW2f0u9dIniZNydsLo9XEtpuRQqLhbhTpZiCfeGp4aI0pufbySPvCY1fN dpfzmQU8azazIVEPBfjl7NhxJee6KGxDaztMLWtpwtLeH+8LbA/CQMTRS/2cemf/ Z3UGKDU+typQxpTwjFK3FKyeWX0rm/1Z+4xgCCgCLokjZRt7NtkX7jpk/WBVHFMI fDTIbG/Hio0aDMHhoweQqlgY2kEyUgUrHguiIlgMFGZX8nH+BZZDd2NzumQg5ZI= =aszV -----END PGP SIGNATURE----- --7UdEQngBiljlgUPvSFAHaDTH4v0JUQ3jx--