From: Stefan Hajnoczi <stefanha@gmail.com>
To: Vincent Palatin <vpalatin@chromium.org>
Cc: qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH 2/3] target-i386: Add Intel HAX files
Date: Wed, 9 Nov 2016 12:30:46 +0000 [thread overview]
Message-ID: <20161109123046.GE4682@stefanha-x1.localdomain> (raw)
In-Reply-To: <dc1f10ce25eab9d517675e0bdecfc6f4f65d77af.1478619442.git.vpalatin@chromium.org>
[-- Attachment #1: Type: text/plain, Size: 1345 bytes --]
On Tue, Nov 08, 2016 at 04:39:28PM +0100, Vincent Palatin wrote:
Please run scripts/checkpatch.pl to verify that the code follows the
QEMU coding style.
> +hax_fd hax_host_open_vcpu(int vmid, int vcpuid)
> +{
> + char *devfs_path = NULL;
> + hax_fd fd;
> +
> + devfs_path = hax_vcpu_devfs_string(vmid, vcpuid);
> + if (!devfs_path) {
> + fprintf(stderr, "Failed to get the devfs\n");
> + return -EINVAL;
> + }
> +
> + fd = open(devfs_path, O_RDWR);
> + qemu_vfree(devfs_path);
g_malloc(), g_new(), g_strdup(), etc must be matched with g_free(), not
qemu_vfree(). There are probably other instances of this issue in the
patches.
> +//#define DEBUG_HAX_SLOT
> +
> +#ifdef DEBUG_HAX_SLOT
> +#define DPRINTF(fmt, ...) \
> + do { fprintf(stdout, fmt, ## __VA_ARGS__); } while (0)
> +#else
> +#define DPRINTF(fmt, ...) \
> + do { } while (0)
> +#endif
Please consider using tracing instead of debug printfs. See docs/tracing.txt.
If you really want to keep macros, please use:
#define DEBUG_HAX_SLOT 0
#define DPRINTF(fmt, ...) \
do { \
if (DEBUG_HAX_SLOT) { \
fprintf(stdout, fmt, ## __VA_ARGS__); \
} \
} while (0)
This approach prevents bitrot because it allows the compiler to syntax
check the format string and arguments even when the printf is compiled
out.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]
next prev parent reply other threads:[~2016-11-09 12:30 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-08 15:39 [Qemu-devel] [PATCH 0/3] [RFC] Add HAX support Vincent Palatin
2016-11-08 15:39 ` [Qemu-devel] [PATCH 1/3] kvm: move cpu synchronization code Vincent Palatin
2016-11-08 17:34 ` Paolo Bonzini
2016-11-08 15:39 ` [Qemu-devel] [PATCH 2/3] target-i386: Add Intel HAX files Vincent Palatin
2016-11-08 17:46 ` Paolo Bonzini
2016-11-08 19:43 ` Vincent Palatin
2016-11-09 17:08 ` Vincent Palatin
2016-11-09 12:30 ` Stefan Hajnoczi [this message]
2016-11-09 17:08 ` Vincent Palatin
2016-11-08 15:39 ` [Qemu-devel] [PATCH 3/3] Plumb the HAXM-based hardware acceleration support Vincent Palatin
2016-11-08 20:37 ` Paolo Bonzini
2016-11-09 17:19 ` Vincent Palatin
2016-11-09 17:32 ` Paolo Bonzini
2016-11-11 11:25 ` Vincent Palatin
2016-11-11 11:26 ` Paolo Bonzini
2016-11-08 17:43 ` [Qemu-devel] [PATCH 0/3] [RFC] Add HAX support Paolo Bonzini
2016-11-08 19:41 ` Vincent Palatin
2016-11-08 20:41 ` Paolo Bonzini
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=20161109123046.GE4682@stefanha-x1.localdomain \
--to=stefanha@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=vpalatin@chromium.org \
/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).