[libvirt] [PATCH] libxl_driver.c: cleanup code

Jim Fehlig jfehlig at suse.com
Fri Mar 21 17:00:24 UTC 2014


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 at suse.com>
> ---
>  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,
>   




More information about the libvir-list mailing list