[PATCH] hw/virtio/vhost-user-scmi: propagate startup errors

zhaoguohan@kylinos.cn posted 1 patch 19 hours ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20261127055424.79483-1-zhaoguohan@kylinos.cn
Maintainers: "Michael S. Tsirkin" <mst@redhat.com>, Stefano Garzarella <sgarzare@redhat.com>, Milan Zamazal <mzamazal@redhat.com>
hw/virtio/vhost-user-scmi.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
[PATCH] hw/virtio/vhost-user-scmi: propagate startup errors
Posted by zhaoguohan@kylinos.cn 19 hours ago
From: Khan Zhao <zhaoguohan@kylinos.cn>

Return errors from vu_scmi_start() through vu_scmi_set_status() so
device startup failures reach the caller.

Remove the duplicate error message after vhost_dev_init(), which
already reports initialization errors through errp.

Signed-off-by: Khan Zhao <zhaoguohan@kylinos.cn>
---
 hw/virtio/vhost-user-scmi.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/hw/virtio/vhost-user-scmi.c b/hw/virtio/vhost-user-scmi.c
index ad5c176c1e2..1dd29ff0008 100644
--- a/hw/virtio/vhost-user-scmi.c
+++ b/hw/virtio/vhost-user-scmi.c
@@ -125,7 +125,7 @@ static int vu_scmi_set_status(VirtIODevice *vdev, uint8_t status)
     }
 
     if (should_start) {
-        vu_scmi_start(vdev);
+        return vu_scmi_start(vdev);
     } else {
         int ret;
         ret = vu_scmi_stop(vdev);
@@ -260,8 +260,6 @@ static void vu_scmi_device_realize(DeviceState *dev, Error **errp)
     ret = vhost_dev_init(&scmi->vhost_dev, &scmi->vhost_user,
                          VHOST_BACKEND_TYPE_USER, 0, errp);
     if (ret < 0) {
-        error_setg_errno(errp, -ret,
-                         "vhost-user-scmi: vhost_dev_init() failed");
         do_vhost_user_cleanup(vdev, scmi, vhost_vqs);
         return;
     }
-- 
2.43.0
Re: [PATCH] hw/virtio/vhost-user-scmi: propagate startup errors
Posted by Milan Zamazal 11 hours ago
zhaoguohan@kylinos.cn writes:

> From: Khan Zhao <zhaoguohan@kylinos.cn>
>
> Return errors from vu_scmi_start() through vu_scmi_set_status() so
> device startup failures reach the caller.
>
> Remove the duplicate error message after vhost_dev_init(), which
> already reports initialization errors through errp.
>
> Signed-off-by: Khan Zhao <zhaoguohan@kylinos.cn>

Reviewed-by: Milan Zamazal <mzamazal@redhat.com>

> ---
>  hw/virtio/vhost-user-scmi.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/hw/virtio/vhost-user-scmi.c b/hw/virtio/vhost-user-scmi.c
> index ad5c176c1e2..1dd29ff0008 100644
> --- a/hw/virtio/vhost-user-scmi.c
> +++ b/hw/virtio/vhost-user-scmi.c
> @@ -125,7 +125,7 @@ static int vu_scmi_set_status(VirtIODevice *vdev, uint8_t status)
>      }
>  
>      if (should_start) {
> -        vu_scmi_start(vdev);
> +        return vu_scmi_start(vdev);
>      } else {
>          int ret;
>          ret = vu_scmi_stop(vdev);
> @@ -260,8 +260,6 @@ static void vu_scmi_device_realize(DeviceState *dev, Error **errp)
>      ret = vhost_dev_init(&scmi->vhost_dev, &scmi->vhost_user,
>                           VHOST_BACKEND_TYPE_USER, 0, errp);
>      if (ret < 0) {
> -        error_setg_errno(errp, -ret,
> -                         "vhost-user-scmi: vhost_dev_init() failed");
>          do_vhost_user_cleanup(vdev, scmi, vhost_vqs);
>          return;
>      }