提交 69a66f13 编写于 作者: M Michal Privoznik

qemu_domain: Drop few useless checks in qemuDomainGetHostdevPath

There are three cases where vir*DeviceGetPath() returns a const
string. In these cases, the string is initialized in
corresponding vir*DeviceNew() calls which fail if string couldn't
be allocated. There's no point in checking the second time if the
string is NULL.
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
Reviewed-by: NCole Robinson <crobinso@redhat.com>
上级 90200667
......@@ -12802,8 +12802,7 @@ qemuDomainGetHostdevPath(virDomainDefPtr def,
if (!usb)
goto cleanup;
if (!(tmpPath = (char *)virUSBDeviceGetPath(usb)))
goto cleanup;
tmpPath = (char *)virUSBDeviceGetPath(usb);
perm = VIR_CGROUP_DEVICE_RW;
break;
......@@ -12824,8 +12823,7 @@ qemuDomainGetHostdevPath(virDomainDefPtr def,
if (!scsi)
goto cleanup;
if (!(tmpPath = (char *)virSCSIDeviceGetPath(scsi)))
goto cleanup;
tmpPath = (char *)virSCSIDeviceGetPath(scsi);
perm = virSCSIDeviceGetReadonly(scsi) ?
VIR_CGROUP_DEVICE_READ : VIR_CGROUP_DEVICE_RW;
}
......@@ -12837,8 +12835,7 @@ qemuDomainGetHostdevPath(virDomainDefPtr def,
if (!(host = virSCSIVHostDeviceNew(hostsrc->wwpn)))
goto cleanup;
if (!(tmpPath = (char *)virSCSIVHostDeviceGetPath(host)))
goto cleanup;
tmpPath = (char *)virSCSIVHostDeviceGetPath(host);
perm = VIR_CGROUP_DEVICE_RW;
}
break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册