diff mbox series

[v1,15/59] block/blkreplay.c: remove unneeded 'fail' label in blkreplay_open()

Message ID 20200106182425.20312-16-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
Both the 'fail' label and the 'ret' variable can be removed.
Use 'return -EINVAL' in the error condition and 'return 0' in
the end of the function.

CC: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
CC: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
---
 block/blkreplay.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

Comments

Pavel Dovgalyuk Jan. 10, 2020, 6:07 a.m. UTC | #1
> From: Daniel Henrique Barboza [mailto:danielhb413@gmail.com]
> Sent: Monday, January 06, 2020 9:24 PM
> To: qemu-devel@nongnu.org
> Cc: qemu-trivial@nongnu.org; Daniel Henrique Barboza; Pavel Dovgalyuk; Paolo Bonzini
> Subject: [PATCH v1 15/59] block/blkreplay.c: remove unneeded 'fail' label in blkreplay_open()
> 
> Both the 'fail' label and the 'ret' variable can be removed.
> Use 'return -EINVAL' in the error condition and 'return 0' in
> the end of the function.
> 
> CC: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
> CC: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>


Reviewed-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>

> ---
>  block/blkreplay.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/block/blkreplay.c b/block/blkreplay.c
> index c96ac8f4bc..d8c4c311f3 100644
> --- a/block/blkreplay.c
> +++ b/block/blkreplay.c
> @@ -24,23 +24,19 @@ static int blkreplay_open(BlockDriverState *bs, QDict *options, int flags,
>                            Error **errp)
>  {
>      Error *local_err = NULL;
> -    int ret;
> 
>      /* Open the image file */
>      bs->file = bdrv_open_child(NULL, options, "image",
>                                 bs, &child_file, false, &local_err);
>      if (local_err) {
> -        ret = -EINVAL;
>          error_propagate(errp, local_err);
> -        goto fail;
> +        return -EINVAL;
>      }
> 
>      bs->supported_write_flags = BDRV_REQ_WRITE_UNCHANGED;
>      bs->supported_zero_flags = BDRV_REQ_WRITE_UNCHANGED;
> 
> -    ret = 0;
> -fail:
> -    return ret;
> +    return 0;
>  }
> 
>  static int64_t blkreplay_getlength(BlockDriverState *bs)
> --
> 2.24.1



Pavel Dovgalyuk
diff mbox series

Patch

diff --git a/block/blkreplay.c b/block/blkreplay.c
index c96ac8f4bc..d8c4c311f3 100644
--- a/block/blkreplay.c
+++ b/block/blkreplay.c
@@ -24,23 +24,19 @@  static int blkreplay_open(BlockDriverState *bs, QDict *options, int flags,
                           Error **errp)
 {
     Error *local_err = NULL;
-    int ret;
 
     /* Open the image file */
     bs->file = bdrv_open_child(NULL, options, "image",
                                bs, &child_file, false, &local_err);
     if (local_err) {
-        ret = -EINVAL;
         error_propagate(errp, local_err);
-        goto fail;
+        return -EINVAL;
     }
 
     bs->supported_write_flags = BDRV_REQ_WRITE_UNCHANGED;
     bs->supported_zero_flags = BDRV_REQ_WRITE_UNCHANGED;
 
-    ret = 0;
-fail:
-    return ret;
+    return 0;
 }
 
 static int64_t blkreplay_getlength(BlockDriverState *bs)