xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Olaf Hering <olaf@aepfle.de>
To: xen-devel@lists.xen.org
Cc: Wei Liu <wei.liu2@citrix.com>, Olaf Hering <olaf@aepfle.de>,
	Ian Jackson <ian.jackson@eu.citrix.com>
Subject: [PATCH] tools: fix compile errors with -Og
Date: Tue, 12 Apr 2016 15:55:19 +0200	[thread overview]
Message-ID: <1460469319-12877-1-git-send-email-olaf@aepfle.de> (raw)

At least gcc-4.8 and older fails to recognize that err is always
initialized, the build fails:
  xc_cpupool.c: In function 'xc_cpupool_removecpu':
  xc_cpupool.c:168:5: error: 'err' may be used uninitialized in this function [-Werror=maybe-uninitialized]
    return err;

Fix this in blktap2 and libxc.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
---
 tools/blktap2/drivers/tapdisk-vbd.c | 6 +++---
 tools/libxc/xc_cpupool.c            | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/blktap2/drivers/tapdisk-vbd.c b/tools/blktap2/drivers/tapdisk-vbd.c
index 89ef9ed..31bc2fe 100644
--- a/tools/blktap2/drivers/tapdisk-vbd.c
+++ b/tools/blktap2/drivers/tapdisk-vbd.c
@@ -516,7 +516,7 @@ tapdisk_vbd_free_stack(td_vbd_t *vbd)
 int
 tapdisk_vbd_open_stack(td_vbd_t *vbd, uint16_t storage, td_flag_t flags)
 {
-	int i, err;
+	int i, err = 0;
 
 	vbd->flags   = flags;
 	vbd->storage = storage;
@@ -932,7 +932,7 @@ tapdisk_vbd_open_image(td_vbd_t *vbd, td_image_t *image)
 static int
 tapdisk_vbd_close_and_reopen_image(td_vbd_t *vbd, td_image_t *image)
 {
-	int i, err;
+	int i, err = 0;
 
 	td_close(image);
 
@@ -972,7 +972,7 @@ tapdisk_vbd_pause(td_vbd_t *vbd)
 int
 tapdisk_vbd_resume(td_vbd_t *vbd, const char *path, uint16_t drivertype)
 {
-	int i, err;
+	int i, err = 0;
 
 	if (!td_flag_test(vbd->state, TD_VBD_PAUSED)) {
 		EPRINTF("resume request for unpaused vbd %s\n", vbd->name);
diff --git a/tools/libxc/xc_cpupool.c b/tools/libxc/xc_cpupool.c
index 261b9c9..abf707d 100644
--- a/tools/libxc/xc_cpupool.c
+++ b/tools/libxc/xc_cpupool.c
@@ -151,7 +151,7 @@ int xc_cpupool_removecpu(xc_interface *xch,
                          int cpu)
 {
     unsigned retries;
-    int err;
+    int err = 0;
     DECLARE_SYSCTL;
 
     sysctl.cmd = XEN_SYSCTL_cpupool_op;

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

             reply	other threads:[~2016-04-12 13:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-12 13:55 Olaf Hering [this message]
2016-04-13 12:05 ` [PATCH] tools: fix compile errors with -Og Dario Faggioli
2016-04-22 18:09 ` Wei Liu

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=1460469319-12877-1-git-send-email-olaf@aepfle.de \
    --to=olaf@aepfle.de \
    --cc=ian.jackson@eu.citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.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).