diff mbox

[PULL,08/38] pci-assign: accept Error from monitor_handle_fd_param2()

Message ID 1399575182-9768-9-git-send-email-lcapitulino@redhat.com
State New
Headers show

Commit Message

Luiz Capitulino May 8, 2014, 6:52 p.m. UTC
From: Laszlo Ersek <lersek@redhat.com>

Propagate any errors in monitor fd handling up to get_real_device(), and
report them there. We'll continue the propagation upwards when
get_real_device() becomes a leaf itself (when none of its callees will
report errors internally any longer when detecting and returning an
error).

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
eviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 hw/i386/kvm/pci-assign.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Comments

Eric Blake May 9, 2014, 10:48 p.m. UTC | #1
On 05/08/2014 12:52 PM, Luiz Capitulino wrote:
> From: Laszlo Ersek <lersek@redhat.com>
> 
> Propagate any errors in monitor fd handling up to get_real_device(), and
> report them there. We'll continue the propagation upwards when
> get_real_device() becomes a leaf itself (when none of its callees will
> report errors internally any longer when detecting and returning an
> error).
> 
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> eviewed-by: Eric Blake <eblake@redhat.com>

If it's not too late, you may want to fix this R-b.

> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
> ---
>  hw/i386/kvm/pci-assign.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>
Luiz Capitulino May 12, 2014, 12:58 p.m. UTC | #2
On Fri, 09 May 2014 16:48:23 -0600
Eric Blake <eblake@redhat.com> wrote:

> On 05/08/2014 12:52 PM, Luiz Capitulino wrote:
> > From: Laszlo Ersek <lersek@redhat.com>
> > 
> > Propagate any errors in monitor fd handling up to get_real_device(), and
> > report them there. We'll continue the propagation upwards when
> > get_real_device() becomes a leaf itself (when none of its callees will
> > report errors internally any longer when detecting and returning an
> > error).
> > 
> > Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> > eviewed-by: Eric Blake <eblake@redhat.com>
> 
> If it's not too late, you may want to fix this R-b.

It is too late.
diff mbox

Patch

diff --git a/hw/i386/kvm/pci-assign.c b/hw/i386/kvm/pci-assign.c
index a825871..bfce97f 100644
--- a/hw/i386/kvm/pci-assign.c
+++ b/hw/i386/kvm/pci-assign.c
@@ -541,6 +541,7 @@  static int get_real_device(AssignedDevice *pci_dev)
     uint16_t id;
     PCIRegion *rp;
     PCIDevRegions *dev = &pci_dev->real_device;
+    Error *local_err = NULL;
 
     dev->region_number = 0;
 
@@ -551,8 +552,12 @@  static int get_real_device(AssignedDevice *pci_dev)
     snprintf(name, sizeof(name), "%sconfig", dir);
 
     if (pci_dev->configfd_name && *pci_dev->configfd_name) {
-        dev->config_fd = monitor_handle_fd_param(cur_mon, pci_dev->configfd_name);
-        if (dev->config_fd < 0) {
+        dev->config_fd = monitor_handle_fd_param2(cur_mon,
+                                                  pci_dev->configfd_name,
+                                                  &local_err);
+        if (local_err) {
+            qerror_report_err(local_err);
+            error_free(local_err);
             return 1;
         }
     } else {