From ab9da5c4abe3a53a883ee4a1e93561237bd0aa68 Mon Sep 17 00:00:00 2001 From: Alexandra Diupina Date: Wed, 17 Jan 2024 19:04:58 +0300 Subject: [PATCH] conf: make virNetDevVPortProfileFormat() void Since commit 4af3cbafdd0e the function always returns 0, so it is possible to make this function void and remove return value checks. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Alexandra Diupina --- src/conf/domain_conf.c | 8 ++++---- src/conf/netdev_vport_profile_conf.c | 10 +++++----- src/conf/netdev_vport_profile_conf.h | 2 +- src/conf/network_conf.c | 7 +++---- src/conf/virnetworkportdef.c | 4 ++-- 5 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 8bddd2c1db..59d51c4c52 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -23783,8 +23783,8 @@ virDomainActualNetDefContentsFormat(virBuffer *buf, if (virNetDevVlanFormat(virDomainNetGetActualVlan(def), buf) < 0) return -1; - if (virNetDevVPortProfileFormat(virDomainNetGetActualVirtPortProfile(def), buf) < 0) - return -1; + virNetDevVPortProfileFormat(virDomainNetGetActualVirtPortProfile(def), buf); + if (virNetDevBandwidthFormat(virDomainNetGetActualBandwidth(def), 0, buf) < 0) return -1; virNetworkPortOptionsFormat(virDomainNetGetActualPortOptionsIsolated(def), buf); @@ -24257,8 +24257,8 @@ virDomainNetDefFormat(virBuffer *buf, if (virNetDevVlanFormat(&def->vlan, buf) < 0) return -1; - if (virNetDevVPortProfileFormat(def->virtPortProfile, buf) < 0) - return -1; + virNetDevVPortProfileFormat(def->virtPortProfile, buf); + if (virNetDevBandwidthFormat(def->bandwidth, 0, buf) < 0) return -1; virNetworkPortOptionsFormat(def->isolatedPort, buf); diff --git a/src/conf/netdev_vport_profile_conf.c b/src/conf/netdev_vport_profile_conf.c index 59237e10de..032a3147d7 100644 --- a/src/conf/netdev_vport_profile_conf.c +++ b/src/conf/netdev_vport_profile_conf.c @@ -177,7 +177,7 @@ virNetDevVPortProfileParse(xmlNodePtr node, unsigned int flags) } -int +void virNetDevVPortProfileFormat(const virNetDevVPortProfile *virtPort, virBuffer *buf) { @@ -185,7 +185,7 @@ virNetDevVPortProfileFormat(const virNetDevVPortProfile *virtPort, bool noParameters; if (!virtPort) - return 0; + return; noParameters = !(virtPort->managerID_specified || virtPort->typeID_specified || @@ -197,13 +197,13 @@ virNetDevVPortProfileFormat(const virNetDevVPortProfile *virtPort, type = virtPort->virtPortType; if (type == VIR_NETDEV_VPORT_PROFILE_NONE) { if (noParameters) - return 0; + return; virBufferAddLit(buf, "\n"); } else { if (noParameters) { virBufferAsprintf(buf, "\n", virNetDevVPortTypeToString(type)); - return 0; + return; } else { virBufferAsprintf(buf, "\n", virNetDevVPortTypeToString(type)); @@ -255,5 +255,5 @@ virNetDevVPortProfileFormat(const virNetDevVPortProfile *virtPort, virBufferAddLit(buf, "/>\n"); virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "\n"); - return 0; + return; } diff --git a/src/conf/netdev_vport_profile_conf.h b/src/conf/netdev_vport_profile_conf.h index 58b104610a..f710d34874 100644 --- a/src/conf/netdev_vport_profile_conf.h +++ b/src/conf/netdev_vport_profile_conf.h @@ -39,6 +39,6 @@ typedef enum { virNetDevVPortProfile * virNetDevVPortProfileParse(xmlNodePtr node, unsigned int flags); -int +void virNetDevVPortProfileFormat(const virNetDevVPortProfile *virtPort, virBuffer *buf); diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c index 6f8a0d2d0b..ed2e72eddf 100644 --- a/src/conf/network_conf.c +++ b/src/conf/network_conf.c @@ -2213,8 +2213,8 @@ virPortGroupDefFormat(virBuffer *buf, virBufferAdjustIndent(buf, 2); if (virNetDevVlanFormat(&def->vlan, buf) < 0) return -1; - if (virNetDevVPortProfileFormat(def->virtPortProfile, buf) < 0) - return -1; + virNetDevVPortProfileFormat(def->virtPortProfile, buf); + virNetDevBandwidthFormat(def->bandwidth, 0, buf); virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "\n"); @@ -2466,8 +2466,7 @@ virNetworkDefFormatBuf(virBuffer *buf, return -1; } - if (virNetDevVPortProfileFormat(def->virtPortProfile, buf) < 0) - return -1; + virNetDevVPortProfileFormat(def->virtPortProfile, buf); for (i = 0; i < def->nPortGroups; i++) if (virPortGroupDefFormat(buf, &def->portGroups[i]) < 0) diff --git a/src/conf/virnetworkportdef.c b/src/conf/virnetworkportdef.c index 64db63ae66..ad6150d5a7 100644 --- a/src/conf/virnetworkportdef.c +++ b/src/conf/virnetworkportdef.c @@ -307,8 +307,8 @@ virNetworkPortDefFormatBuf(virBuffer *buf, virMacAddrFormat(&def->mac, macaddr); virBufferAsprintf(buf, "\n", macaddr); - if (virNetDevVPortProfileFormat(def->virtPortProfile, buf) < 0) - return -1; + virNetDevVPortProfileFormat(def->virtPortProfile, buf); + if (def->bandwidth) virNetDevBandwidthFormat(def->bandwidth, def->class_id, buf); if (virNetDevVlanFormat(&def->vlan, buf) < 0) -- 2.47.2