]> git.ipfire.org Git - thirdparty/libvirt.git/commit
nodedev: fix build with clang
authorRoman Bogorodskiy <bogorodskiy@gmail.com>
Sat, 18 Feb 2017 11:46:28 +0000 (15:46 +0400)
committerRoman Bogorodskiy <bogorodskiy@gmail.com>
Sat, 18 Feb 2017 13:49:27 +0000 (17:49 +0400)
commitd3ffa0ece8b063f34868b0dce51671ac285ebfdd
treeebf8f86fa0ddf7985be39c179839a2d69daec025
parent78c018693b4090a5ae9716276ed2ac60da4814ef
nodedev: fix build with clang

Build fails with:

conf/node_device_conf.c:825:62: error: comparison of unsigned enum expression < 0 is always false [-Werror,-Wtautological-compare]
    if ((data->drm.type = virNodeDevDRMTypeFromString(type)) < 0) {
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~
conf/node_device_conf.c:1801:59: error: comparison of unsigned enum expression < 0 is always false [-Werror,-Wtautological-compare]
        if ((type = virNodeDevDevnodeTypeFromString(tmp)) < 0) {
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~
2 errors generated.

Fix by using intermediate variable to store the result similarly
to how it's done for other FromString* calls.
src/conf/node_device_conf.c