Re: [PATCH v1 30/59] util/module.c: remove unneeded label in module_load_file()

2020-01-07 Thread Thomas Huth
On 06/01/2020 19.23, Daniel Henrique Barboza wrote:
> 'out' can be replaced by the apropriate return values set
> in 'ret' for each case.
> 
> CC: Paolo Bonzini 
> Signed-off-by: Daniel Henrique Barboza 
> ---
>  util/module.c | 11 ---
>  1 file changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/util/module.c b/util/module.c
> index e9fe3e5422..9b5453f878 100644
> --- a/util/module.c
> +++ b/util/module.c
> @@ -111,12 +111,10 @@ static int module_load_file(const char *fname)
>  
>  if (len <= suf_len || strcmp(&fname[len - suf_len], dsosuf)) {
>  /* wrong suffix */
> -ret = -EINVAL;
> -goto out;
> +return -EINVAL;
>  }
>  if (access(fname, F_OK)) {
> -ret = -ENOENT;
> -goto out;
> +return -ENOENT;
>  }
>  
>  assert(QTAILQ_EMPTY(&dso_init_list));
> @@ -125,8 +123,7 @@ static int module_load_file(const char *fname)
>  if (!g_module) {
>  fprintf(stderr, "Failed to open module: %s\n",
>  g_module_error());
> -ret = -EINVAL;
> -goto out;
> +return -EINVAL;
>  }
>  if (!g_module_symbol(g_module, DSO_STAMP_FUN_STR, (gpointer *)&sym)) {
>  fprintf(stderr, "Failed to initialize module: %s\n",
> @@ -151,7 +148,7 @@ static int module_load_file(const char *fname)
>  QTAILQ_REMOVE(&dso_init_list, e, node);
>  g_free(e);
>  }
> -out:
> +
>  return ret;
>  }
>  #endif
> 

Reviewed-by: Thomas Huth 




[PATCH v1 30/59] util/module.c: remove unneeded label in module_load_file()

2020-01-06 Thread Daniel Henrique Barboza
'out' can be replaced by the apropriate return values set
in 'ret' for each case.

CC: Paolo Bonzini 
Signed-off-by: Daniel Henrique Barboza 
---
 util/module.c | 11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/util/module.c b/util/module.c
index e9fe3e5422..9b5453f878 100644
--- a/util/module.c
+++ b/util/module.c
@@ -111,12 +111,10 @@ static int module_load_file(const char *fname)
 
 if (len <= suf_len || strcmp(&fname[len - suf_len], dsosuf)) {
 /* wrong suffix */
-ret = -EINVAL;
-goto out;
+return -EINVAL;
 }
 if (access(fname, F_OK)) {
-ret = -ENOENT;
-goto out;
+return -ENOENT;
 }
 
 assert(QTAILQ_EMPTY(&dso_init_list));
@@ -125,8 +123,7 @@ static int module_load_file(const char *fname)
 if (!g_module) {
 fprintf(stderr, "Failed to open module: %s\n",
 g_module_error());
-ret = -EINVAL;
-goto out;
+return -EINVAL;
 }
 if (!g_module_symbol(g_module, DSO_STAMP_FUN_STR, (gpointer *)&sym)) {
 fprintf(stderr, "Failed to initialize module: %s\n",
@@ -151,7 +148,7 @@ static int module_load_file(const char *fname)
 QTAILQ_REMOVE(&dso_init_list, e, node);
 g_free(e);
 }
-out:
+
 return ret;
 }
 #endif
-- 
2.24.1