qemu-trivial
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v1 20/59] block/vpc.c: remove unneeded 'fail' label in create_dyn


From: Daniel Henrique Barboza
Subject: [PATCH v1 20/59] block/vpc.c: remove unneeded 'fail' label in create_dynamic_disk()
Date: Mon, 6 Jan 2020 15:23:46 -0300

'fail' label can be replaced by 'return ret' on error and
'return 0' in the end of the function.

CC: Kevin Wolf <address@hidden>
CC: address@hidden
Signed-off-by: Daniel Henrique Barboza <address@hidden>
---
 block/vpc.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/block/vpc.c b/block/vpc.c
index a65550298e..2678b48dfd 100644
--- a/block/vpc.c
+++ b/block/vpc.c
@@ -839,13 +839,13 @@ static int create_dynamic_disk(BlockBackend *blk, uint8_t 
*buf,
 
     ret = blk_pwrite(blk, offset, buf, HEADER_SIZE, 0);
     if (ret < 0) {
-        goto fail;
+        return ret;
     }
 
     offset = 1536 + ((num_bat_entries * 4 + 511) & ~511);
     ret = blk_pwrite(blk, offset, buf, HEADER_SIZE, 0);
     if (ret < 0) {
-        goto fail;
+        return ret;
     }
 
     /* Write the initial BAT */
@@ -855,7 +855,7 @@ static int create_dynamic_disk(BlockBackend *blk, uint8_t 
*buf,
     for (i = 0; i < DIV_ROUND_UP(num_bat_entries * 4, 512); i++) {
         ret = blk_pwrite(blk, offset, buf, 512, 0);
         if (ret < 0) {
-            goto fail;
+            return ret;
         }
         offset += 512;
     }
@@ -882,12 +882,10 @@ static int create_dynamic_disk(BlockBackend *blk, uint8_t 
*buf,
 
     ret = blk_pwrite(blk, offset, buf, 1024, 0);
     if (ret < 0) {
-        goto fail;
+        return ret;
     }
 
-    ret = 0;
- fail:
-    return ret;
+    return 0;
 }
 
 static int create_fixed_disk(BlockBackend *blk, uint8_t *buf,
-- 
2.24.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]