diff mbox series

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

Message ID 20200106182425.20312-31-danielhb413@gmail.com
State New
Headers show
Series trivial unneeded labels cleanup | expand

Commit Message

Daniel Henrique Barboza Jan. 6, 2020, 6:23 p.m. UTC
'out' can be replaced by the apropriate return values set
in 'ret' for each case.

CC: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
---
 util/module.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

Comments

Thomas Huth Jan. 7, 2020, 11:26 a.m. UTC | #1
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 <pbonzini@redhat.com>
> Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
> ---
>  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 <thuth@redhat.com>
diff mbox series

Patch

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