Set to ret = -1 and prove otherwise, like usual Signed-off-by: John Ferlan <jfer...@redhat.com> --- src/qemu/qemu_conf.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 80b8926..5ebf2cc 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -1448,7 +1448,7 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev) char *sysfs_path = NULL; const char *path = NULL; int val = -1; - int ret = 0; + int ret = -1; /* "sgio" is only valid for block disk; cdrom * and floopy disk can have empty source. @@ -1467,24 +1467,19 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev) if (!qemuIsSharedHostdev(hostdev)) return 0; - if (hostdev->source.subsys.u.scsi.sgio) { + if (hostdev->source.subsys.u.scsi.sgio) virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("'sgio' is not supported for SCSI " "generic device yet ")); - ret = -1; goto cleanup; - } return 0; } else { return 0; } - sysfs_path = virGetUnprivSGIOSysfsPath(path, NULL); - if (sysfs_path == NULL) { - ret = -1; + if (!(sysfs_path = virGetUnprivSGIOSysfsPath(path, NULL))) goto cleanup; - } /* By default, filter the SG_IO commands, i.e. set unpriv_sgio to 0. */ val = (disk->sgio == VIR_DOMAIN_DEVICE_SGIO_UNFILTERED); @@ -1495,7 +1490,9 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev) */ if ((virFileExists(sysfs_path) || val == 1) && virSetDeviceUnprivSGIO(path, NULL, val) < 0) - ret = -1; + goto cleanup; + + ret = 0; cleanup: VIR_FREE(sysfs_path); -- 2.1.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list