diff mbox series

[v1,17/59] block/dmg.c: remove unneeded 'fail' label in dmg_read_mish_block()

Message ID 20200106182425.20312-18-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 'ret' variable can be removed from the
function. Instead, call 'return -EINVAL' in the error conditions.

CC: Stefan Hajnoczi <stefanha@redhat.com>
CC: qemu-block@nongnu.org
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
---
 block/dmg.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

Comments

Stefan Hajnoczi Jan. 7, 2020, 4:54 p.m. UTC | #1
On Mon, Jan 06, 2020 at 03:23:43PM -0300, Daniel Henrique Barboza wrote:
> Both the 'fail' label and 'ret' variable can be removed from the
> function. Instead, call 'return -EINVAL' in the error conditions.
> 
> CC: Stefan Hajnoczi <stefanha@redhat.com>
> CC: qemu-block@nongnu.org
> Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
> ---
>  block/dmg.c | 10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
diff mbox series

Patch

diff --git a/block/dmg.c b/block/dmg.c
index 4a045f2b3e..ce39a87864 100644
--- a/block/dmg.c
+++ b/block/dmg.c
@@ -217,7 +217,6 @@  static int dmg_read_mish_block(BDRVDMGState *s, DmgHeaderState *ds,
                                uint8_t *buffer, uint32_t count)
 {
     uint32_t type, i;
-    int ret;
     size_t new_size;
     uint32_t chunk_count;
     int64_t offset = 0;
@@ -273,8 +272,7 @@  static int dmg_read_mish_block(BDRVDMGState *s, DmgHeaderState *ds,
             error_report("sector count %" PRIu64 " for chunk %" PRIu32
                          " is larger than max (%u)",
                          s->sectorcounts[i], i, DMG_SECTORCOUNTS_MAX);
-            ret = -EINVAL;
-            goto fail;
+            return -EINVAL;
         }
 
         /* offset in (compressed) data fork */
@@ -288,8 +286,7 @@  static int dmg_read_mish_block(BDRVDMGState *s, DmgHeaderState *ds,
             error_report("length %" PRIu64 " for chunk %" PRIu32
                          " is larger than max (%u)",
                          s->lengths[i], i, DMG_LENGTHS_MAX);
-            ret = -EINVAL;
-            goto fail;
+            return -EINVAL;
         }
 
         update_max_chunk_size(s, i, &ds->max_compressed_size,
@@ -298,9 +295,6 @@  static int dmg_read_mish_block(BDRVDMGState *s, DmgHeaderState *ds,
     }
     s->n_chunks += chunk_count;
     return 0;
-
-fail:
-    return ret;
 }
 
 static int dmg_read_resource_fork(BlockDriverState *bs, DmgHeaderState *ds,