Re: [PATCH] libxl: use pci init and dispose functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Olaf Hering wrote:
> Rearrange code so that the local variable is always initialized and
> disposed.
>
> Signed-off-by: Olaf Hering <olaf@xxxxxxxxx>
> Cc: Jim Fehlig <jfehlig@xxxxxxxx>
> ---
>  src/libxl/libxl_driver.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
>   

ACK and pushed.

Regards,
Jim

> diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
> index 393f8bd..d76efda 100644
> --- a/src/libxl/libxl_driver.c
> +++ b/src/libxl/libxl_driver.c
> @@ -2893,12 +2893,14 @@ libxlDomainAttachHostPCIDevice(libxlDriverPrivatePtr driver,
>                                 virDomainHostdevDefPtr hostdev)
>  {
>      libxlDriverConfigPtr cfg = libxlDriverConfigGet(driver);
> -     libxl_device_pci pcidev;
> +    libxl_device_pci pcidev;
>      virDomainHostdevDefPtr found;
>      virHostdevManagerPtr hostdev_mgr = driver->hostdevMgr;
>      virDomainHostdevSubsysPCIPtr pcisrc = &hostdev->source.subsys.u.pci;
>      int ret = -1;
>  
> +    libxl_device_pci_init(&pcidev);
> +
>      if (hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI)
>          goto cleanup;
>  
> @@ -2939,6 +2941,7 @@ libxlDomainAttachHostPCIDevice(libxlDriverPrivatePtr driver,
>  
>   cleanup:
>      virObjectUnref(cfg);
> +    libxl_device_pci_dispose(&pcidev);
>      return ret;
>  }
>  
> @@ -3234,6 +3237,8 @@ libxlDomainDetachHostPCIDevice(libxlDriverPrivatePtr driver,
>      virHostdevManagerPtr hostdev_mgr = driver->hostdevMgr;
>      int ret = -1;
>  
> +    libxl_device_pci_init(&pcidev);
> +
>      if (subsys->type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI)
>          goto cleanup;
>  
> @@ -3255,8 +3260,6 @@ libxlDomainDetachHostPCIDevice(libxlDriverPrivatePtr driver,
>      }
>  
>  
> -    libxl_device_pci_init(&pcidev);
> -
>      if (libxlMakePCI(detach, &pcidev) < 0)
>          goto error;
>  
> @@ -3269,7 +3272,6 @@ libxlDomainDetachHostPCIDevice(libxlDriverPrivatePtr driver,
>          goto error;
>      }
>  
> -    libxl_device_pci_dispose(&pcidev);
>  
>      virDomainHostdevRemove(vm->def, idx);
>  
> @@ -3283,6 +3285,7 @@ libxlDomainDetachHostPCIDevice(libxlDriverPrivatePtr driver,
>  
>   cleanup:
>      virObjectUnref(cfg);
> +    libxl_device_pci_dispose(&pcidev);
>      return ret;
>  }
>  
>
>
>   

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]