diff mbox series

[v3,18/25] block/backup: drop extra gotos from backup_run()

Message ID 20201026171815.13233-19-vsementsov@virtuozzo.com
State Accepted
Commit 511e7d31bf107aca331ab834f71c90267f803960
Headers show
Series None | expand

Commit Message

Vladimir Sementsov-Ogievskiy Oct. 26, 2020, 5:18 p.m. UTC
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
 block/backup.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

Comments

Max Reitz Jan. 12, 2021, 12:40 p.m. UTC | #1
On 26.10.20 18:18, Vladimir Sementsov-Ogievskiy wrote:
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>

> ---

>   block/backup.c | 12 +++++-------

>   1 file changed, 5 insertions(+), 7 deletions(-)


Reviewed-by: Max Reitz <mreitz@redhat.com>
diff mbox series

Patch

diff --git a/block/backup.c b/block/backup.c
index 8c67d77504..449b763ce4 100644
--- a/block/backup.c
+++ b/block/backup.c
@@ -236,7 +236,7 @@  static void backup_init_bcs_bitmap(BackupBlockJob *job)
 static int coroutine_fn backup_run(Job *job, Error **errp)
 {
     BackupBlockJob *s = container_of(job, BackupBlockJob, common.job);
-    int ret = 0;
+    int ret;
 
     backup_init_bcs_bitmap(s);
 
@@ -246,13 +246,12 @@  static int coroutine_fn backup_run(Job *job, Error **errp)
 
         for (offset = 0; offset < s->len; ) {
             if (yield_and_check(s)) {
-                ret = -ECANCELED;
-                goto out;
+                return -ECANCELED;
             }
 
             ret = block_copy_reset_unallocated(s->bcs, offset, &count);
             if (ret < 0) {
-                goto out;
+                return ret;
             }
 
             offset += count;
@@ -273,11 +272,10 @@  static int coroutine_fn backup_run(Job *job, Error **errp)
             job_yield(job);
         }
     } else {
-        ret = backup_loop(s);
+        return backup_loop(s);
     }
 
- out:
-    return ret;
+    return 0;
 }
 
 static const BlockJobDriver backup_job_driver = {