Re: [PATCH v6 08/13] qemu: Add zPCI address definition check

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

 



On Fri, 2018-09-28 at 16:46 +0800, Yi Min Zhao wrote:
[...]
> +static int
> +qemuDomainDeviceDefValidateAddress(const virDomainDeviceDef *dev,
> +                                   virQEMUCapsPtr qemuCaps)
> +{
> +    virDomainDeviceInfoPtr info =
> +        virDomainDeviceGetInfo((virDomainDeviceDef *)dev);
> +
> +    if (!info)
> +        return 0;

Using

  virDomainDeviceInfoPtr info;

  if (!(info = virDomainDeviceGetInfo((virDomainDeviceDef *)dev)))
    return 0;

here would look much better.

[...]
> @@ -5811,6 +5844,10 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDef *dev,
>                                              def->emulator)))
>          return -1;
>  
> +    ret = qemuDomainDeviceDefValidateAddress(dev, qemuCaps);
> +    if (ret < 0)
> +        goto out;

This could be

  if ((ret = qemuDomainDeviceDefValidateAddress(dev, qemuCaps)) < 0)
      ...

[...]
> @@ -5886,6 +5923,7 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDef *dev,
>          break;
>      }
>  
> + out:
>      virObjectUnref(qemuCaps);
>      return ret;

'cleanup' would be a more appropriate name for the label since
you're releasing resources when you reach it.


With the above addressed,

  Reviewed-by: Andrea Bolognani <abologna@xxxxxxxxxx>

-- 
Andrea Bolognani / Red Hat / Virtualization

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

  Powered by Linux