Patchwork [1/7] error.c: don't return value for void function

login
register
mail settings
Submitter Stefan Hajnoczi
Date April 20, 2012, 12:52 p.m.
Message ID <1334926356-7807-2-git-send-email-stefanha@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/154038/
State New
Headers show

Comments

Stefan Hajnoczi - April 20, 2012, 12:52 p.m.
From: Amos Kong <akong@redhat.com>

It is invalid to return a value from a function
returning void.

[C99 6.8.6.4 says "A return statement with an expression shall not
appear in a function whose return type is void" but gcc 4.6.3 with QEMU
compile flags does not complain.  It's still worth fixing this.  Stefan]

Signed-off-by: Amos Kong <akong@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
---
 error.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch

diff --git a/error.c b/error.c
index d3455ab..a52b771 100644
--- a/error.c
+++ b/error.c
@@ -93,7 +93,7 @@  QDict *error_get_data(Error *err)
 void error_set_field(Error *err, const char *field, const char *value)
 {
     QDict *dict = qdict_get_qdict(err->obj, "data");
-    return qdict_put(dict, field, qstring_from_str(value));
+    qdict_put(dict, field, qstring_from_str(value));
 }
 
 void error_free(Error *err)