diff options
author | Kevin Wolf <kwolf@redhat.com> | 2021-06-09 08:46:52 -0700 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2021-06-30 13:15:44 +0200 |
commit | a6945f2287aa7f048b263d7187364cbf1dd5d94d (patch) | |
tree | 999b68cfc5e64af247afbc10b6fb99983583e76a /hw/scsi | |
parent | bf783261f0aee6e81af3916bff7606d71ccdc153 (diff) | |
download | qemu-a6945f2287aa7f048b263d7187364cbf1dd5d94d.zip qemu-a6945f2287aa7f048b263d7187364cbf1dd5d94d.tar.gz qemu-a6945f2287aa7f048b263d7187364cbf1dd5d94d.tar.bz2 |
vhost: Add Error parameter to vhost_dev_init()
This allows callers to return better error messages instead of making
one up while the real error ends up on stderr. Most callers can
immediately make use of this because they already have an Error
parameter themselves. The others just keep printing the error with
error_report_err().
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20210609154658.350308-2-kwolf@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Raphael Norwitz <raphael.norwitz@nutanix.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw/scsi')
-rw-r--r-- | hw/scsi/vhost-scsi.c | 4 | ||||
-rw-r--r-- | hw/scsi/vhost-user-scsi.c | 4 |
2 files changed, 2 insertions, 6 deletions
diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c index 4d70fa0..8c611bf 100644 --- a/hw/scsi/vhost-scsi.c +++ b/hw/scsi/vhost-scsi.c @@ -219,10 +219,8 @@ static void vhost_scsi_realize(DeviceState *dev, Error **errp) vsc->dev.backend_features = 0; ret = vhost_dev_init(&vsc->dev, (void *)(uintptr_t)vhostfd, - VHOST_BACKEND_TYPE_KERNEL, 0); + VHOST_BACKEND_TYPE_KERNEL, 0, errp); if (ret < 0) { - error_setg(errp, "vhost-scsi: vhost initialization failed: %s", - strerror(-ret)); goto free_vqs; } diff --git a/hw/scsi/vhost-user-scsi.c b/hw/scsi/vhost-user-scsi.c index 4666019..1b2f7ee 100644 --- a/hw/scsi/vhost-user-scsi.c +++ b/hw/scsi/vhost-user-scsi.c @@ -122,10 +122,8 @@ static void vhost_user_scsi_realize(DeviceState *dev, Error **errp) vqs = vsc->dev.vqs; ret = vhost_dev_init(&vsc->dev, &s->vhost_user, - VHOST_BACKEND_TYPE_USER, 0); + VHOST_BACKEND_TYPE_USER, 0, errp); if (ret < 0) { - error_setg(errp, "vhost-user-scsi: vhost initialization failed: %s", - strerror(-ret)); goto free_vhost; } |