All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block/monitor: Consolidate hmp_handle_error calls to reduce redundant code
@ 2021-08-02  6:25 Mao Zhongyi
  2021-08-19 13:11 ` Hanna Reitz
  0 siblings, 1 reply; 2+ messages in thread
From: Mao Zhongyi @ 2021-08-02  6:25 UTC (permalink / raw)
  To: qemu-block, qemu-devel; +Cc: kwolf, Mao Zhongyi, mreitz

Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
---
 block/monitor/block-hmp-cmds.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c
index 3e6670c963..2ac4aedfff 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);
 }
 
-- 
2.31.1





^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] block/monitor: Consolidate hmp_handle_error calls to reduce redundant code
  2021-08-02  6:25 [PATCH] block/monitor: Consolidate hmp_handle_error calls to reduce redundant code Mao Zhongyi
@ 2021-08-19 13:11 ` Hanna Reitz
  0 siblings, 0 replies; 2+ messages in thread
From: Hanna Reitz @ 2021-08-19 13:11 UTC (permalink / raw)
  To: Mao Zhongyi, qemu-block, qemu-devel; +Cc: kwolf, mreitz

On 02.08.21 08:25, Mao Zhongyi wrote:
> Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
> ---
>   block/monitor/block-hmp-cmds.c | 12 ++++++------
>   1 file changed, 6 insertions(+), 6 deletions(-)

Thanks, applied to my block-next branch for 6.2:

https://github.com/XanClic/qemu/commits/block-next

Hanna



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-19 13:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-02  6:25 [PATCH] block/monitor: Consolidate hmp_handle_error calls to reduce redundant code Mao Zhongyi
2021-08-19 13:11 ` Hanna Reitz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.