From nobody Wed May 15 23:33:36 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1706003014876332.23283989448237; Tue, 23 Jan 2024 01:43:34 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id EB4B319F2; Tue, 23 Jan 2024 04:43:32 -0500 (EST) Received: from lists.libvirt.org.85.43.8.in-addr.arpa (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 4A2CF1947; Tue, 23 Jan 2024 04:41:15 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id A2A9C1C24; Wed, 17 Jan 2024 11:11:56 -0500 (EST) Received: from mail.astralinux.ru (mail.astralinux.ru [217.74.38.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 0C8EF1C0F for ; Wed, 17 Jan 2024 11:11:54 -0500 (EST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.astralinux.ru (Postfix) with ESMTP id 1AA7F1869D6E; Wed, 17 Jan 2024 19:05:26 +0300 (MSK) Received: from mail.astralinux.ru ([127.0.0.1]) by localhost (rbta-msk-vsrv-mail01.astralinux.ru [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id A7VMX3EELMQO; Wed, 17 Jan 2024 19:05:25 +0300 (MSK) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.astralinux.ru (Postfix) with ESMTP id A02061869D6D; Wed, 17 Jan 2024 19:05:25 +0300 (MSK) Received: from mail.astralinux.ru ([127.0.0.1]) by localhost (rbta-msk-vsrv-mail01.astralinux.ru [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id Tx14kt2ldEEM; Wed, 17 Jan 2024 19:05:25 +0300 (MSK) Received: from rbta-msk-lt-302690.astralinux.ru (unknown [10.177.233.12]) by mail.astralinux.ru (Postfix) with ESMTPSA id 3B5D11869D6C; Wed, 17 Jan 2024 19:05:25 +0300 (MSK) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-Greylist: delayed 387 seconds by postgrey-1.37 at lists.libvirt.org; Wed, 17 Jan 2024 11:11:55 EST X-Virus-Scanned: amavisd-new at astralinux.ru From: Alexandra Diupina To: devel@lists.libvirt.org Subject: [PATCH] conf: make virNetDevVPortProfileFormat() void Date: Wed, 17 Jan 2024 19:04:58 +0300 Message-Id: <20240117160458.18793-1-adiupina@astralinux.ru> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-MailFrom: adiupina@astralinux.ru X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0 Message-ID-Hash: 7KAKE742LF4KI3RIIIJLLDXH53QPEGEJ X-Message-ID-Hash: 7KAKE742LF4KI3RIIIJLLDXH53QPEGEJ X-Mailman-Approved-At: Tue, 23 Jan 2024 09:41:12 -0500 CC: Alexandra Diupina , sdl.libvirt@linuxtesting.org X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1706003017732100001 In commit 4af3cbafdd0e31c5c5b20d57c4aaeb19efcb98bc (Laine Stump , Tue Jul 31 14:36:51 2012 -0400) the return -1 was removed and since then virNetDevVPortProfileFormat() 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 Reviewed-by: Martin Kletzander --- 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 6211d2a51b..dac2584cf2 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -23767,8 +23767,8 @@ virDomainActualNetDefContentsFormat(virBuffer *buf, =20 if (virNetDevVlanFormat(virDomainNetGetActualVlan(def), buf) < 0) return -1; - if (virNetDevVPortProfileFormat(virDomainNetGetActualVirtPortProfile(d= ef), buf) < 0) - return -1; + virNetDevVPortProfileFormat(virDomainNetGetActualVirtPortProfile(def),= buf); + if (virNetDevBandwidthFormat(virDomainNetGetActualBandwidth(def), 0, b= uf) < 0) return -1; virNetworkPortOptionsFormat(virDomainNetGetActualPortOptionsIsolated(d= ef), buf); @@ -24241,8 +24241,8 @@ virDomainNetDefFormat(virBuffer *buf, =20 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_p= rofile_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 in= t flags) } =20 =20 -int +void virNetDevVPortProfileFormat(const virNetDevVPortProfile *virtPort, virBuffer *buf) { @@ -185,7 +185,7 @@ virNetDevVPortProfileFormat(const virNetDevVPortProfile= *virtPort, bool noParameters; =20 if (!virtPort) - return 0; + return; =20 noParameters =3D !(virtPort->managerID_specified || virtPort->typeID_specified || @@ -197,13 +197,13 @@ virNetDevVPortProfileFormat(const virNetDevVPortProfi= le *virtPort, type =3D virtPort->virtPortType; if (type =3D=3D 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_p= rofile_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); =20 -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; } =20 - if (virNetDevVPortProfileFormat(def->virtPortProfile, buf) < 0) - return -1; + virNetDevVPortProfileFormat(def->virtPortProfile, buf); =20 for (i =3D 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); =20 - 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) --=20 2.30.2 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org