diff options
author | Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | 2021-08-02 14:25:07 +0800 |
---|---|---|
committer | Hanna Reitz <hreitz@redhat.com> | 2021-09-01 12:57:31 +0200 |
commit | 8cca0bd289ed8aa1f4f26539bd9450fa04e16fc0 (patch) | |
tree | 617eff8cef5a5747efdbe0f09bfe8c495d8f0e24 /block/monitor | |
parent | 8ffcda2a70008fa69bab6c58e5ed362d924c7b55 (diff) | |
download | qemu-8cca0bd289ed8aa1f4f26539bd9450fa04e16fc0.zip qemu-8cca0bd289ed8aa1f4f26539bd9450fa04e16fc0.tar.gz qemu-8cca0bd289ed8aa1f4f26539bd9450fa04e16fc0.tar.bz2 |
block/monitor: Consolidate hmp_handle_error calls to reduce redundant 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>
Diffstat (limited to 'block/monitor')
-rw-r--r-- | block/monitor/block-hmp-cmds.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c index 3e6670c..2ac4aed 100644 --- a/block/monitor/block-hmp-cmds.c +++ b/block/monitor/block-hmp-cmds.c @@ -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); } @@ -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); } @@ -356,8 +356,7 @@ 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; @@ -365,6 +364,7 @@ void hmp_snapshot_blkdev(Monitor *mon, const QDict *qdict) filename, false, NULL, !!format, format, true, mode, &err); +end: hmp_handle_error(mon, err); } |