Patchwork error.c: don't return value for void function

login
register
mail settings
Submitter Amos Kong
Date April 16, 2012, 7:32 a.m.
Message ID <20120416073249.13295.65065.stgit@dhcp-8-167.nay.redhat.com>
Download mbox | patch
Permalink /patch/152771/
State New
Headers show

Comments

Amos Kong - April 16, 2012, 7:32 a.m.
It is invalid to return a value from a function
returning void.

Signed-off-by: Amos Kong <akong@redhat.com>
---
 error.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Paolo Bonzini - April 16, 2012, 8:58 a.m.
Il 16/04/2012 09:32, Amos Kong ha scritto:
> It is invalid to return a value from a function
> returning void.
> 
> Signed-off-by: Amos Kong <akong@redhat.com>
> ---
>  error.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> 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)

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Stefan Hajnoczi - April 16, 2012, 9:43 a.m.
On Mon, Apr 16, 2012 at 03:32:49PM +0800, Amos Kong wrote:
> It is invalid to return a value from a function
> returning void.
> 
> Signed-off-by: Amos Kong <akong@redhat.com>
> ---
>  error.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)

Thanks, applied to the trivial patches tree:
https://github.com/stefanha/qemu/commits/trivial-patches

Stefan

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)