[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
- [PATCH v1 12/59] virtfs-proxy-helper.c: remove 'err_out' label in setugid(), (continued)
[PATCH v1 13/59] block/vdi.c: remove 'fail' label in vdi_open(), Daniel Henrique Barboza, 2020/01/06
[PATCH v1 15/59] block/blkreplay.c: remove unneeded 'fail' label in blkreplay_open(), Daniel Henrique Barboza, 2020/01/06
[PATCH v1 20/59] block/vpc.c: remove unneeded 'fail' label in create_dynamic_disk(),
Daniel Henrique Barboza <=
[PATCH v1 24/59] block/vhdx-log.c: remove unneeded labels, Daniel Henrique Barboza, 2020/01/06
[PATCH v1 26/59] block/replication.c: remove unneeded label in replication_co_writev, Daniel Henrique Barboza, 2020/01/06
[PATCH v1 27/59] crypto/block-luks.c: remove unneeded label in qcrypto_block_luks_find_key, Daniel Henrique Barboza, 2020/01/06
[PATCH v1 38/59] s390x/sclp.c: remove unneeded label in sclp_service_call(), Daniel Henrique Barboza, 2020/01/06
[PATCH v1 09/59] chardev/char-pipe.c: remove 'fail' label in win_chr_pipe_init(), Daniel Henrique Barboza, 2020/01/06
[PATCH v1 18/59] qcow2-refcount.c: remove unneeded 'fail' label in qcow2_refcount_init(), Daniel Henrique Barboza, 2020/01/06
[PATCH v1 23/59] block/vxhs.c: remove unneeded 'out' label in vxhs_iio_callback(), Daniel Henrique Barboza, 2020/01/06