]> xenbits.xensource.com Git - libvirt.git/commitdiff
virPCIDeviceHasVPD: Refactor "debug" messages
authorPeter Krempa <pkrempa@redhat.com>
Mon, 29 Jan 2024 15:53:27 +0000 (16:53 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 31 Jan 2024 16:24:07 +0000 (17:24 +0100)
A checker function should not raise VIR_INFO or VIR_WARN messages
especially if they contain information useful only for debugging.

Turn the message into a VIR_DEBUG with universal meaning.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/util/virpci.c

index 6c04e57038f4c4e7312c5a6460319b0846efeb5b..99e6e6cbb1921b6323f92f48d34d7bdfc313e83c 100644 (file)
@@ -3081,17 +3081,12 @@ virPCIGetVirtualFunctionInfo(const char *vf_sysfs_device_path,
 bool
 virPCIDeviceHasVPD(virPCIDevice *dev)
 {
-    g_autofree char *vpdPath = NULL;
+    g_autofree char *vpdPath = virPCIFile(dev->name, "vpd");
+    bool ret = virFileIsRegular(vpdPath);
 
-    vpdPath = virPCIFile(dev->name, "vpd");
-    if (!virFileExists(vpdPath)) {
-        VIR_INFO("Device VPD file does not exist %s", vpdPath);
-        return false;
-    } else if (!virFileIsRegular(vpdPath)) {
-        VIR_WARN("VPD path does not point to a regular file %s", vpdPath);
-        return false;
-    }
-    return true;
+    VIR_DEBUG("path='%s', exists='%d'", vpdPath, ret);
+
+    return ret;
 }
 
 /**