[PATCH 5/9] monitor/hmp-cmds: delete redundant Error check before invoke hmp_handle_error()

Mao Zhongyi posted 9 patches 5 years, 8 months ago
Maintainers: Juan Quintela <quintela@redhat.com>, "Dr. David Alan Gilbert" <dgilbert@redhat.com>
[PATCH 5/9] monitor/hmp-cmds: delete redundant Error check before invoke hmp_handle_error()
Posted by Mao Zhongyi 5 years, 8 months ago
hmp_handle_error() does Error check internally.

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

diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
index 6938f1060e..acdd6baff3 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
@@ -1636,9 +1636,8 @@ void hmp_object_add(Monitor *mon, const QDict *qdict)
     obj = user_creatable_add_opts(opts, &err);
     qemu_opts_del(opts);
 
-    if (err) {
-        hmp_handle_error(mon, err);
-    }
+    hmp_handle_error(mon, err);
+
     if (obj) {
         object_unref(obj);
     }
-- 
2.17.1




Re: [PATCH 5/9] monitor/hmp-cmds: delete redundant Error check before invoke hmp_handle_error()
Posted by Dr. David Alan Gilbert 5 years, 8 months ago
* Mao Zhongyi (maozhongyi@cmss.chinamobile.com) wrote:
> hmp_handle_error() does Error check internally.
> 
> Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

> ---
>  monitor/hmp-cmds.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
> index 6938f1060e..acdd6baff3 100644
> --- a/monitor/hmp-cmds.c
> +++ b/monitor/hmp-cmds.c
> @@ -1636,9 +1636,8 @@ void hmp_object_add(Monitor *mon, const QDict *qdict)
>      obj = user_creatable_add_opts(opts, &err);
>      qemu_opts_del(opts);
>  
> -    if (err) {
> -        hmp_handle_error(mon, err);
> -    }
> +    hmp_handle_error(mon, err);
> +
>      if (obj) {
>          object_unref(obj);
>      }
> -- 
> 2.17.1
> 
> 
> 
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK