Re: [libvirt PATCH 1/3] nodedev: remove unnecessary null check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 4/13/21 4:49 PM, Jonathon Jongsma wrote:
g_strdup_printf() is guaranteed to return a non-NULL value, so remove
the unnecessary check for NULL.

Signed-off-by: Jonathon Jongsma <jjongsma@xxxxxxxxxx>
---
  src/util/virmdev.c | 3 ---
  1 file changed, 3 deletions(-)

diff --git a/src/util/virmdev.c b/src/util/virmdev.c
index 7f4a499536..102eb2bf67 100644
--- a/src/util/virmdev.c
+++ b/src/util/virmdev.c
@@ -208,9 +208,6 @@ virMediatedDeviceGetIOMMUGroupDev(const char *uuidstr)
      g_autofree char *iommu_path = NULL;
      g_autofree char *dev_path = virMediatedDeviceGetSysfsPath(uuidstr);
- if (!dev_path)
-        return NULL;

virMediatedDeviceGetSysfsPath() is called in 2 other places where the return is checked for NULL.

As long as you're getting rid of this NULL check, how about just turning this patch into "remove unnecessary check for NULL on return from virMediatedDeviceGetSysfsPath"?

Reviewed-by: Laine Stump <laine@xxxxxxxxxx>

either with this single change, or with all three.

-
      iommu_path = g_strdup_printf("%s/iommu_group", dev_path);
if (!virFileExists(iommu_path)) {





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux