Message ID | 20200603080904.997083-7-maozhongyi@cmss.chinamobile.com |
---|---|
State | New |
Headers | show |
Series | monitor/hmp-cmds: small improvements for migration | expand |
* Mao Zhongyi (maozhongyi@cmss.chinamobile.com) wrote: > Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> Yes OK; I don't particularly like goto's; especially in these simpler cases, but it's OK. Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> > --- > monitor/hmp-cmds.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c > index acdd6baff3..e8cf72eb3a 100644 > --- a/monitor/hmp-cmds.c > +++ b/monitor/hmp-cmds.c > @@ -1501,8 +1501,7 @@ void hmp_change(Monitor *mon, const QDict *qdict) > read_only, > BLOCKDEV_CHANGE_READ_ONLY_MODE_RETAIN, &err); > if (err) { > - hmp_handle_error(mon, err); > - return; > + goto end; > } > } > > @@ -1511,6 +1510,7 @@ void hmp_change(Monitor *mon, const QDict *qdict) > &err); > } > > +end: > hmp_handle_error(mon, err); > } > > @@ -1629,13 +1629,13 @@ void hmp_object_add(Monitor *mon, const QDict *qdict) > > opts = qemu_opts_from_qdict(qemu_find_opts("object"), qdict, &err); > if (err) { > - hmp_handle_error(mon, err); > - return; > + goto end; > } > > obj = user_creatable_add_opts(opts, &err); > qemu_opts_del(opts); > > +end: > hmp_handle_error(mon, err); > > if (obj) { > -- > 2.17.1 > > > > -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index acdd6baff3..e8cf72eb3a 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -1501,8 +1501,7 @@ void hmp_change(Monitor *mon, const QDict *qdict) read_only, BLOCKDEV_CHANGE_READ_ONLY_MODE_RETAIN, &err); if (err) { - hmp_handle_error(mon, err); - return; + goto end; } } @@ -1511,6 +1510,7 @@ void hmp_change(Monitor *mon, const QDict *qdict) &err); } +end: hmp_handle_error(mon, err); } @@ -1629,13 +1629,13 @@ void hmp_object_add(Monitor *mon, const QDict *qdict) opts = qemu_opts_from_qdict(qemu_find_opts("object"), qdict, &err); if (err) { - hmp_handle_error(mon, err); - return; + goto end; } obj = user_creatable_add_opts(opts, &err); qemu_opts_del(opts); +end: hmp_handle_error(mon, err); if (obj) {
Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> --- monitor/hmp-cmds.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)