提交 931ac3cd 编写于 作者: J John Ferlan

qemu: Refactor qemuSetUnprivSGIO return values

Set to ret = -1 and prove otherwise, like usual
Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
上级 38307953
...@@ -1434,7 +1434,7 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev) ...@@ -1434,7 +1434,7 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
char *sysfs_path = NULL; char *sysfs_path = NULL;
const char *path = NULL; const char *path = NULL;
int val = -1; int val = -1;
int ret = 0; int ret = -1;
/* "sgio" is only valid for block disk; cdrom /* "sgio" is only valid for block disk; cdrom
* and floopy disk can have empty source. * and floopy disk can have empty source.
...@@ -1457,7 +1457,6 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev) ...@@ -1457,7 +1457,6 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("'sgio' is not supported for SCSI " _("'sgio' is not supported for SCSI "
"generic device yet ")); "generic device yet "));
ret = -1;
goto cleanup; goto cleanup;
} }
...@@ -1466,11 +1465,8 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev) ...@@ -1466,11 +1465,8 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
return 0; return 0;
} }
sysfs_path = virGetUnprivSGIOSysfsPath(path, NULL); if (!(sysfs_path = virGetUnprivSGIOSysfsPath(path, NULL)))
if (sysfs_path == NULL) {
ret = -1;
goto cleanup; goto cleanup;
}
/* By default, filter the SG_IO commands, i.e. set unpriv_sgio to 0. */ /* By default, filter the SG_IO commands, i.e. set unpriv_sgio to 0. */
val = (disk->sgio == VIR_DOMAIN_DEVICE_SGIO_UNFILTERED); val = (disk->sgio == VIR_DOMAIN_DEVICE_SGIO_UNFILTERED);
...@@ -1481,7 +1477,9 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev) ...@@ -1481,7 +1477,9 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
*/ */
if ((virFileExists(sysfs_path) || val == 1) && if ((virFileExists(sysfs_path) || val == 1) &&
virSetDeviceUnprivSGIO(path, NULL, val) < 0) virSetDeviceUnprivSGIO(path, NULL, val) < 0)
ret = -1; goto cleanup;
ret = 0;
cleanup: cleanup:
VIR_FREE(sysfs_path); VIR_FREE(sysfs_path);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册