[PATCH] conf: node_device: Fix build with clang

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

 



Clang complains:

  ../libvirt/src/conf/node_device_conf.c:1945:74: error: result of comparison of unsigned enum expression < 0 is always false [-Werror,-Wtautological-unsigned-enum-zero-compare]
        if ((mdev->start = virNodeDevMdevStartTypeFromString(starttype)) < 0) {

Fixes: 42a55854993
Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/conf/node_device_conf.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Pushed as fix for a build-breaker.

diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index 4e2b37c612..5598d420fe 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -1942,11 +1942,14 @@ virNodeDevCapMdevParseXML(xmlXPathContextPtr ctxt,
     }

     if ((starttype = virXPathString("string(./start[1]/@type)", ctxt))) {
-        if ((mdev->start = virNodeDevMdevStartTypeFromString(starttype)) < 0) {
+        int tmp;
+        if ((tmp = virNodeDevMdevStartTypeFromString(starttype)) < 0) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            _("unknown mdev start type '%s' for '%s'"), starttype, def->name);
             return -1;
         }
+
+        mdev->start = tmp;
     } else {
         mdev->start = VIR_NODE_DEV_MDEV_START_MANUAL;
     }
-- 
2.31.1




[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