mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
node_device_udev: Fix build failure in ccw device code
clang complains:
../../../libvirt/src/node_device/node_device_udev.c:1408:82: error: result of comparison of unsigned enum expression < 0 is always false [-Werror,-Wtautological-unsigned-enum-zero-compare]
1408 | if ((data->ccwgroup_dev.type = virNodeDevCCWGroupCapTypeFromString(devtype)) < 0)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~
1 error generated.
Fix it by adding a temporary int variable to facilitate the check before
assigning to the unsigned enum value.
Fixes: 985cb9c32a
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
78f72efddc
commit
15cd4ec832
@ -1398,6 +1398,7 @@ udevProcessCCWGroup(struct udev_device *device,
|
||||
{
|
||||
const char *devtype = udev_device_get_devtype(device);
|
||||
virNodeDevCapData *data = &def->caps->data;
|
||||
int tmp;
|
||||
|
||||
data->ccwgroup_dev.address = virCCWDeviceAddressFromString(udev_device_get_sysname(device));
|
||||
|
||||
@ -1405,9 +1406,11 @@ udevProcessCCWGroup(struct udev_device *device,
|
||||
|
||||
udevGenerateDeviceName(device, def, NULL);
|
||||
|
||||
if ((data->ccwgroup_dev.type = virNodeDevCCWGroupCapTypeFromString(devtype)) < 0)
|
||||
if ((tmp = virNodeDevCCWGroupCapTypeFromString(devtype)) < 0)
|
||||
return -1;
|
||||
|
||||
data->ccwgroup_dev.type = tmp;
|
||||
|
||||
switch (data->ccwgroup_dev.type) {
|
||||
case VIR_NODE_DEV_CAP_CCWGROUP_QETH_GENERIC:
|
||||
case VIR_NODE_DEV_CAP_CCWGROUP_QETH_LAYER2:
|
||||
|
Loading…
Reference in New Issue
Block a user