diff mbox

[RFC,v1,1/2] xen/hw/passthrough: Use errno instead of ret for xc_physdev_map_* calls

Message ID 1426275418-8411-2-git-send-email-konrad.wilk@oracle.com
State New
Headers show

Commit Message

Konrad Rzeszutek Wilk March 13, 2015, 7:36 p.m. UTC
As the libxc library follows (mostly) the return negative
for failure and stashes the error value in errno.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
 hw/xen/xen_pt.c     | 4 ++--
 hw/xen/xen_pt_msi.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

Comments

Stefano Stabellini March 16, 2015, 10:13 a.m. UTC | #1
On Fri, 13 Mar 2015, Konrad Rzeszutek Wilk wrote:
> As the libxc library follows (mostly) the return negative
> for failure and stashes the error value in errno.
> 
> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

I'll add it to my queue


>  hw/xen/xen_pt.c     | 4 ++--
>  hw/xen/xen_pt_msi.c | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/xen/xen_pt.c b/hw/xen/xen_pt.c
> index c1bf357..d2c187d 100644
> --- a/hw/xen/xen_pt.c
> +++ b/hw/xen/xen_pt.c
> @@ -691,8 +691,8 @@ static int xen_pt_initfn(PCIDevice *d)
>      rc = xc_physdev_map_pirq(xen_xc, xen_domid, machine_irq, &pirq);
>  
>      if (rc < 0) {
> -        XEN_PT_ERR(d, "Mapping machine irq %u to pirq %i failed, (rc: %d)\n",
> -                   machine_irq, pirq, rc);
> +        XEN_PT_ERR(d, "Mapping machine irq %u to pirq %i failed, (err: %d)\n",
> +                   machine_irq, pirq, errno);
>  
>          /* Disable PCI intx assertion (turn on bit10 of devctl) */
>          xen_host_pci_set_word(&s->real_device,
> diff --git a/hw/xen/xen_pt_msi.c b/hw/xen/xen_pt_msi.c
> index 9ed9321..b01921a 100644
> --- a/hw/xen/xen_pt_msi.c
> +++ b/hw/xen/xen_pt_msi.c
> @@ -132,8 +132,8 @@ static int msi_msix_setup(XenPCIPassthroughState *s,
>                                       msix_entry, table_base);
>          if (rc) {
>              XEN_PT_ERR(&s->dev,
> -                       "Mapping of MSI%s (rc: %i, vec: %#x, entry %#x)\n",
> -                       is_msix ? "-X" : "", rc, gvec, msix_entry);
> +                       "Mapping of MSI%s (err: %i, vec: %#x, entry %#x)\n",
> +                       is_msix ? "-X" : "", errno, gvec, msix_entry);
>              return rc;
>          }
>      }
> -- 
> 2.1.0
>
Konrad Rzeszutek Wilk March 16, 2015, 2:27 p.m. UTC | #2
On Mon, Mar 16, 2015 at 10:13:50AM +0000, Stefano Stabellini wrote:
> On Fri, 13 Mar 2015, Konrad Rzeszutek Wilk wrote:
> > As the libxc library follows (mostly) the return negative
> > for failure and stashes the error value in errno.
> > 
> > Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> 
> Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> 
> I'll add it to my queue

Thank you.
> 
> 
> >  hw/xen/xen_pt.c     | 4 ++--
> >  hw/xen/xen_pt_msi.c | 4 ++--
> >  2 files changed, 4 insertions(+), 4 deletions(-)
> > 
> > diff --git a/hw/xen/xen_pt.c b/hw/xen/xen_pt.c
> > index c1bf357..d2c187d 100644
> > --- a/hw/xen/xen_pt.c
> > +++ b/hw/xen/xen_pt.c
> > @@ -691,8 +691,8 @@ static int xen_pt_initfn(PCIDevice *d)
> >      rc = xc_physdev_map_pirq(xen_xc, xen_domid, machine_irq, &pirq);
> >  
> >      if (rc < 0) {
> > -        XEN_PT_ERR(d, "Mapping machine irq %u to pirq %i failed, (rc: %d)\n",
> > -                   machine_irq, pirq, rc);
> > +        XEN_PT_ERR(d, "Mapping machine irq %u to pirq %i failed, (err: %d)\n",
> > +                   machine_irq, pirq, errno);
> >  
> >          /* Disable PCI intx assertion (turn on bit10 of devctl) */
> >          xen_host_pci_set_word(&s->real_device,
> > diff --git a/hw/xen/xen_pt_msi.c b/hw/xen/xen_pt_msi.c
> > index 9ed9321..b01921a 100644
> > --- a/hw/xen/xen_pt_msi.c
> > +++ b/hw/xen/xen_pt_msi.c
> > @@ -132,8 +132,8 @@ static int msi_msix_setup(XenPCIPassthroughState *s,
> >                                       msix_entry, table_base);
> >          if (rc) {
> >              XEN_PT_ERR(&s->dev,
> > -                       "Mapping of MSI%s (rc: %i, vec: %#x, entry %#x)\n",
> > -                       is_msix ? "-X" : "", rc, gvec, msix_entry);
> > +                       "Mapping of MSI%s (err: %i, vec: %#x, entry %#x)\n",
> > +                       is_msix ? "-X" : "", errno, gvec, msix_entry);
> >              return rc;
> >          }
> >      }
> > -- 
> > 2.1.0
> >
diff mbox

Patch

diff --git a/hw/xen/xen_pt.c b/hw/xen/xen_pt.c
index c1bf357..d2c187d 100644
--- a/hw/xen/xen_pt.c
+++ b/hw/xen/xen_pt.c
@@ -691,8 +691,8 @@  static int xen_pt_initfn(PCIDevice *d)
     rc = xc_physdev_map_pirq(xen_xc, xen_domid, machine_irq, &pirq);
 
     if (rc < 0) {
-        XEN_PT_ERR(d, "Mapping machine irq %u to pirq %i failed, (rc: %d)\n",
-                   machine_irq, pirq, rc);
+        XEN_PT_ERR(d, "Mapping machine irq %u to pirq %i failed, (err: %d)\n",
+                   machine_irq, pirq, errno);
 
         /* Disable PCI intx assertion (turn on bit10 of devctl) */
         xen_host_pci_set_word(&s->real_device,
diff --git a/hw/xen/xen_pt_msi.c b/hw/xen/xen_pt_msi.c
index 9ed9321..b01921a 100644
--- a/hw/xen/xen_pt_msi.c
+++ b/hw/xen/xen_pt_msi.c
@@ -132,8 +132,8 @@  static int msi_msix_setup(XenPCIPassthroughState *s,
                                      msix_entry, table_base);
         if (rc) {
             XEN_PT_ERR(&s->dev,
-                       "Mapping of MSI%s (rc: %i, vec: %#x, entry %#x)\n",
-                       is_msix ? "-X" : "", rc, gvec, msix_entry);
+                       "Mapping of MSI%s (err: %i, vec: %#x, entry %#x)\n",
+                       is_msix ? "-X" : "", errno, gvec, msix_entry);
             return rc;
         }
     }