Re: [PATCH] libxl_driver.c: cleanup code

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

 



Chunyan Liu wrote:
> Following Jim's comments about "add pci passthrough to libxl" patch:
> https://www.redhat.com/archives/libvir-list/2014-March/msg00170.html
>   

Thanks for addressing those comments.

> Signed-off-by: Chunyan Liu <cyliu@xxxxxxxx>
> ---
>  src/libxl/libxl_driver.c | 47 +++++++++++++++++++----------------------------
>  1 file changed, 19 insertions(+), 28 deletions(-)
>
> diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
> index a6ba10a..4d22fb7 100644
> --- a/src/libxl/libxl_driver.c
> +++ b/src/libxl/libxl_driver.c
> @@ -3357,10 +3357,10 @@ libxlDomainAttachHostPCIDevice(libxlDriverPrivatePtr driver,
>      if (virHostdevPreparePCIDevices(hostdev_mgr, LIBXL_DRIVER_NAME,
>                                      vm->def->name, vm->def->uuid,
>                                      &hostdev, 1, 0) < 0)
> -        goto cleanup;
> +        return -1;
>  
>      if (libxlMakePci(hostdev, &pcidev) < 0)
> -        goto reattach_hostdev;
> +        goto error;
>  
>      if (libxl_device_pci_add(priv->ctx, vm->def->id, &pcidev, 0) < 0) {
>          virReportError(VIR_ERR_INTERNAL_ERROR,
> @@ -3369,17 +3369,15 @@ libxlDomainAttachHostPCIDevice(libxlDriverPrivatePtr driver,
>                         hostdev->source.subsys.u.pci.addr.bus,
>                         hostdev->source.subsys.u.pci.addr.slot,
>                         hostdev->source.subsys.u.pci.addr.function);
> -        goto reattach_hostdev;
> +        goto error;
>      }
>  
>      vm->def->hostdevs[vm->def->nhostdevs++] = hostdev;
>      return 0;
>  
> -reattach_hostdev:
> +error:
>   

Even with the current discussion about label indentation, I left these
as is since every label in the libxl driver violates the proposed rule
:).  They can be changed in bulk if the rule is adopted.

[...]
> @@ -5053,18 +5045,17 @@ libxlNodeDeviceReset(virNodeDevicePtr dev)
>          goto cleanup;
>  
>      if (virHostdevPCINodeDeviceReset(hostdev_mgr, pci) < 0)
> -        goto out;
> +        goto cleanup;
>  
>      ret = 0;
> -out:
> -    virPCIDeviceFree(pci);
> +
>  cleanup:
> +    virPCIDeviceFree(pci);
>      virNodeDeviceDefFree(def);
>      VIR_FREE(xml);
>      return ret;
>  }
>  
> -
>   

ACK and pushed, with the exception of this spurious whitespace change.

Regards,
Jim

>  static virDriver libxlDriver = {
>      .no = VIR_DRV_LIBXL,
>      .name = LIBXL_DRIVER_NAME,
>   

--
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]