From: Eric Blake <eblake@redhat.com>
To: zhanghailiang <zhang.zhanghailiang@huawei.com>, qemu-devel@nongnu.org
Cc: peter.huangpeng@huawei.com, luonengjun@huawei.com,
armbru@redhat.com, lcapitulino@redhat.com
Subject: Re: [Qemu-devel] [PATCH v7 2/2] dump: Turn some functions to void to make code cleaner
Date: Wed, 08 Oct 2014 08:57:41 -0600 [thread overview]
Message-ID: <543550E5.1090707@redhat.com> (raw)
In-Reply-To: <1412068849-14848-3-git-send-email-zhang.zhanghailiang@huawei.com>
[-- Attachment #1: Type: text/plain, Size: 1879 bytes --]
On 09/30/2014 03:20 AM, zhanghailiang wrote:
> Functions shouldn't return an error code and an Error object at the same 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_err.
>
> Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
> ---
> dump.c | 313 ++++++++++++++++++++++++++++++-----------------------------------
> 1 file changed, 143 insertions(+), 170 deletions(-)
>
> @@ -348,49 +326,45 @@ static int write_elf_section(DumpState *s, int type, Error **errp)
> ret = fd_write_vmcore(&shdr, shdr_size, s);
> if (ret < 0) {
> dump_error(s, "dump: failed to write section header table", errp);
> - return -1;
> + return;
> }
> -
> - return 0;
> }
The 'return' here is not in a loop, and therefore not necessary.
>
> -static int write_data(DumpState *s, void *buf, int length, Error **errp)
> +static void write_data(DumpState *s, void *buf, int length, Error **errp)
> {
> int ret;
>
> ret = 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.
>
> /* 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 char *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 <eblake@redhat.com>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 539 bytes --]
next prev parent reply other threads:[~2014-10-08 14:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-30 9:20 [Qemu-devel] [PATCH v7 0/2] Return error reasons to caller when calling qmp_dump_guest_memory zhanghailiang
2014-09-30 9:20 ` [Qemu-devel] [PATCH v7 1/2] dump: Propagate errors into qmp_dump_guest_memory() zhanghailiang
2014-10-08 14:50 ` Eric Blake
2014-09-30 9:20 ` [Qemu-devel] [PATCH v7 2/2] dump: Turn some functions to void to make code cleaner zhanghailiang
2014-10-08 0:53 ` zhanghailiang
2014-10-08 14:57 ` Eric Blake [this message]
2014-10-09 2:12 ` zhanghailiang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=543550E5.1090707@redhat.com \
--to=eblake@redhat.com \
--cc=armbru@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=luonengjun@huawei.com \
--cc=peter.huangpeng@huawei.com \
--cc=qemu-devel@nongnu.org \
--cc=zhang.zhanghailiang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).