summary refs log tree commit diff stats
path: root/hw/vfio/platform.c
diff options
context:
space:
mode:
authorEric Auger <eric.auger@redhat.com>2016-10-17 10:57:59 -0600
committerAlex Williamson <alex.williamson@redhat.com>2016-10-17 10:57:59 -0600
commit1b808d5be070e9d07e5d0e5b825a31a0cf87001d (patch)
treef333c493936265c1d659f8cf771ad619110a5f89 /hw/vfio/platform.c
parent01905f58f166646619c35a2ebfc3ca3ed4cad62d (diff)
downloadfocaccia-qemu-1b808d5be070e9d07e5d0e5b825a31a0cf87001d.tar.gz
focaccia-qemu-1b808d5be070e9d07e5d0e5b825a31a0cf87001d.zip
vfio: Pass an error object to vfio_get_group
Pass an error object to prepare for migration to VFIO-PCI realize.

For the time being let's just simply report the error in
vfio platform's vfio_base_device_init(). A subsequent patch will
duly propagate the error up to vfio_platform_realize.

Signed-off-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'hw/vfio/platform.c')
-rw-r--r--hw/vfio/platform.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/hw/vfio/platform.c b/hw/vfio/platform.c
index a559e7b659..7bf525b918 100644
--- a/hw/vfio/platform.c
+++ b/hw/vfio/platform.c
@@ -552,6 +552,7 @@ static int vfio_base_device_init(VFIODevice *vbasedev)
     ssize_t len;
     struct stat st;
     int groupid;
+    Error *err = NULL;
     int ret;
 
     /* @sysfsdev takes precedence over @host */
@@ -592,10 +593,10 @@ static int vfio_base_device_init(VFIODevice *vbasedev)
 
     trace_vfio_platform_base_device_init(vbasedev->name, groupid);
 
-    group = vfio_get_group(groupid, &address_space_memory);
+    group = vfio_get_group(groupid, &address_space_memory, &err);
     if (!group) {
-        error_report("vfio: failed to get group %d", groupid);
-        return -ENOENT;
+        ret = -ENOENT;
+        goto error;
     }
 
     QLIST_FOREACH(vbasedev_iter, &group->device_list, next) {
@@ -619,6 +620,10 @@ static int vfio_base_device_init(VFIODevice *vbasedev)
         vfio_put_group(group);
     }
 
+error:
+    if (err) {
+        error_reportf_err(err, ERR_PREFIX, vbasedev->name);
+    }
     return ret;
 }