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: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
if (!usb)
goto cleanup;
- if (!(tmpPath = (char *)virUSBDeviceGetPath(usb)))
- goto cleanup;
+ tmpPath = (char *)virUSBDeviceGetPath(usb);
perm = VIR_CGROUP_DEVICE_RW;
break;
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;
}
if (!(host = virSCSIVHostDeviceNew(hostsrc->wwpn)))
goto cleanup;
- if (!(tmpPath = (char *)virSCSIVHostDeviceGetPath(host)))
- goto cleanup;
+ tmpPath = (char *)virSCSIVHostDeviceGetPath(host);
perm = VIR_CGROUP_DEVICE_RW;
}
break;