mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-13 08:58:33 +03:00
qemu: remove unnecessary null check
virMediatedDeviceGetSysfsPath() (via g_strdup_printf()) is guaranteed to return a non-NULL value, so remove the unnecessary checks for NULL. Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com> Reviewed-by: Laine Stump <laine@redhat.com> Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
parent
e7a999364e
commit
e8794b911c
@ -5138,9 +5138,7 @@ qemuBuildHostdevMediatedDevStr(const virDomainDef *def,
|
||||
g_autofree char *mdevPath = NULL;
|
||||
const char *dev_str = NULL;
|
||||
|
||||
if (!(mdevPath = virMediatedDeviceGetSysfsPath(mdevsrc->uuidstr)))
|
||||
return NULL;
|
||||
|
||||
mdevPath = virMediatedDeviceGetSysfsPath(mdevsrc->uuidstr);
|
||||
dev_str = qemuBuildHostdevMdevModelTypeString(mdevsrc);
|
||||
|
||||
if (!dev_str)
|
||||
|
@ -140,9 +140,7 @@ virMediatedDeviceNew(const char *uuidstr, virMediatedDeviceModelType model)
|
||||
g_autoptr(virMediatedDevice) dev = NULL;
|
||||
g_autofree char *sysfspath = NULL;
|
||||
|
||||
if (!(sysfspath = virMediatedDeviceGetSysfsPath(uuidstr)))
|
||||
return NULL;
|
||||
|
||||
sysfspath = virMediatedDeviceGetSysfsPath(uuidstr);
|
||||
if (!virFileExists(sysfspath)) {
|
||||
virReportError(VIR_ERR_DEVICE_MISSING,
|
||||
_("mediated device '%s' not found"), uuidstr);
|
||||
@ -208,9 +206,6 @@ virMediatedDeviceGetIOMMUGroupDev(const char *uuidstr)
|
||||
g_autofree char *iommu_path = NULL;
|
||||
g_autofree char *dev_path = virMediatedDeviceGetSysfsPath(uuidstr);
|
||||
|
||||
if (!dev_path)
|
||||
return NULL;
|
||||
|
||||
iommu_path = g_strdup_printf("%s/iommu_group", dev_path);
|
||||
|
||||
if (!virFileExists(iommu_path)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user