Skip to content

Commit

Permalink
block/monitor: Consolidate hmp_handle_error calls to reduce redundant…
Browse files Browse the repository at this point in the history
… code

Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
Message-Id: <20210802062507.347555-1-maozhongyi@cmss.chinamobile.com>
Signed-off-by: Hanna Reitz <hreitz@redhat.com>
  • Loading branch information
Mao Zhongyi authored and XanClic committed Sep 1, 2021
1 parent 8ffcda2 commit 8cca0bd
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions block/monitor/block-hmp-cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,10 +251,10 @@ void hmp_drive_mirror(Monitor *mon, const QDict *qdict)

if (!filename) {
error_setg(&err, QERR_MISSING_PARAMETER, "target");
hmp_handle_error(mon, err);
return;
goto end;
}
qmp_drive_mirror(&mirror, &err);
end:
hmp_handle_error(mon, err);
}

Expand All @@ -281,11 +281,11 @@ void hmp_drive_backup(Monitor *mon, const QDict *qdict)

if (!filename) {
error_setg(&err, QERR_MISSING_PARAMETER, "target");
hmp_handle_error(mon, err);
return;
goto end;
}

qmp_drive_backup(&backup, &err);
end:
hmp_handle_error(mon, err);
}

Expand Down Expand Up @@ -356,15 +356,15 @@ void hmp_snapshot_blkdev(Monitor *mon, const QDict *qdict)
* will be taken internally. Today it's actually required.
*/
error_setg(&err, QERR_MISSING_PARAMETER, "snapshot-file");
hmp_handle_error(mon, err);
return;
goto end;
}

mode = reuse ? NEW_IMAGE_MODE_EXISTING : NEW_IMAGE_MODE_ABSOLUTE_PATHS;
qmp_blockdev_snapshot_sync(true, device, false, NULL,
filename, false, NULL,
!!format, format,
true, mode, &err);
end:
hmp_handle_error(mon, err);
}

Expand Down

0 comments on commit 8cca0bd

Please sign in to comment.