zhanghailiang <zhang.zhanghaili...@huawei.com> writes:

> qerror_report_err() is a transitional interface to help with
> converting existing monitor commands to QMP.  It should not be used
> elsewhere.  Replace by error_report_err() in qdev_init() and
> device_post_init().
>
> Signed-off-by: zhanghailiang <zhang.zhanghaili...@huawei.com>
> ---
>  hw/core/qdev.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/hw/core/qdev.c b/hw/core/qdev.c
> index 44c6b93..9adcd27 100644
> --- a/hw/core/qdev.c
> +++ b/hw/core/qdev.c
> @@ -181,8 +181,7 @@ int qdev_init(DeviceState *dev)
>  
>      object_property_set_bool(OBJECT(dev), true, "realized", &local_err);
>      if (local_err != NULL) {
> -        qerror_report_err(local_err);
> -        error_free(local_err);
> +        error_report_err(local_err);
>          object_unparent(OBJECT(dev));
>          return -1;
>      }

This breaks QMP device_add's error reply.

The patches I posted together remove all calls of qdev_init().  Once
they're all merged, the function should be simply dropped.

> @@ -1189,8 +1188,7 @@ static void device_post_init(Object *obj)
>      Error *err = NULL;
>      qdev_prop_set_globals(DEVICE(obj), &err);
>      if (err) {
> -        qerror_report_err(err);
> -        error_free(err);
> +        error_report_err(err);
>          exit(EXIT_FAILURE);
>      }
>  }

This one is part of a wider problem I solved in

[PATCH] qdev: Don't exit when running into bad -global

Reply via email to