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.dovga...@ispras.ru>
CC: Paolo Bonzini <pbonz...@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb...@gmail.com>
---
 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


Reply via email to