From nobody Sun Feb 8 21:48:08 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1614768623; cv=none; d=zohomail.com; s=zohoarc; b=SydEbZV1KGkR7p58xf//Hc1xXUpLcy2yo/tlkmbCCJv2YTlfX/jEYIbSJwjD/cBff9oEJYspAvJE7q+V4Lh/A+4dbSkU+Viz4UPz5DHOLigOiE5zc4KNWOCbyLrO/QBjcFOaXFKlF92vQfmUvy5aJQX5VdqiAUaXgyEq7n2WpAQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614768623; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=DMF/oiIM3EEInrGgCTwh/BKXC4zOoqy/RliCaK5frcc=; b=OTMHqr30X0xN0EvLWkUAkVE374/X+ridbzMKtnbwZJ1ThdggnLvJq48tIKKfA44+3VVOIm50FVALJPbgCq0JXe9qCvcvtWbgU2gqARMYho2Q5IQJLzusVQrRvaV1QRZc23v8zyfFwwD/cQqHB8lXs8nRJbDTaL8LCFvHFp+D+bQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1614768623078972.3625036308825; Wed, 3 Mar 2021 02:50:23 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-414-lC0Nsm_mNhGQfZl-A9Ug9Q-1; Wed, 03 Mar 2021 05:49:00 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7D63C8030CC; Wed, 3 Mar 2021 10:48:55 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 597315F722; Wed, 3 Mar 2021 10:48:55 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 1AFF258076; Wed, 3 Mar 2021 10:48:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 123Amq7V028461 for ; Wed, 3 Mar 2021 05:48:52 -0500 Received: by smtp.corp.redhat.com (Postfix) id 962E55D9E2; Wed, 3 Mar 2021 10:48:52 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.40.195.71]) by smtp.corp.redhat.com (Postfix) with ESMTP id E9B0C5D9DD for ; Wed, 3 Mar 2021 10:48:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614768622; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=DMF/oiIM3EEInrGgCTwh/BKXC4zOoqy/RliCaK5frcc=; b=AyGwiuadpKKEx+75gYTuEjYlS1vYQ4ebNRJfhrT67dmkl7cWZ0dkwboJ1C1jJJ2s9f4Z/0 nnr7GTOAYnkKrOIGZ4WPQs2KTeZZeXpBLesfMGaHytvKRZ4IdcWPF7juqRvm6yNe8TIQG3 g2XEViWf80632Wa2DVp2wtDS/ha1Lxg= X-MC-Unique: lC0Nsm_mNhGQfZl-A9Ug9Q-1 From: Kristina Hanicova To: libvir-list@redhat.com Subject: [PATCH v2 6/6] netdev_bandwidth_conf: Remove redundant variables/labels Date: Wed, 3 Mar 2021 11:48:20 +0100 Message-Id: <3de2777622a83641be6c4bbf6ed8fad715ee3bb3.1614767298.git.khanicov@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) In functions: virNetDevBandwidthParseRate(), virNetDevBandwidthParse() Signed-off-by: Kristina Hanicova Reviewed-by: J=C3=A1n Tomko --- src/conf/netdev_bandwidth_conf.c | 42 +++++++++++++------------------- 1 file changed, 17 insertions(+), 25 deletions(-) diff --git a/src/conf/netdev_bandwidth_conf.c b/src/conf/netdev_bandwidth_c= onf.c index 81590efe6d..13abca94ec 100644 --- a/src/conf/netdev_bandwidth_conf.c +++ b/src/conf/netdev_bandwidth_conf.c @@ -28,7 +28,6 @@ static int virNetDevBandwidthParseRate(xmlNodePtr node, virNetDevBandwidthRatePtr rat= e) { - int ret =3D -1; g_autofree char *average =3D NULL; g_autofree char *peak =3D NULL; g_autofree char *burst =3D NULL; @@ -50,45 +49,42 @@ virNetDevBandwidthParseRate(xmlNodePtr node, virNetDevB= andwidthRatePtr rate) virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("could not convert bandwidth average value '%= s'"), average); - goto cleanup; + return -1; } } else if (!floor) { virReportError(VIR_ERR_XML_DETAIL, "%s", _("Missing mandatory average or floor attributes")); - goto cleanup; + return -1; } =20 if ((peak || burst) && !average) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("'peak' and 'burst' require 'average' attribute")= ); - goto cleanup; + return -1; } =20 if (peak && virStrToLong_ullp(peak, NULL, 10, &rate->peak) < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("could not convert bandwidth peak value '%s'"), peak); - goto cleanup; + return -1; } =20 if (burst && virStrToLong_ullp(burst, NULL, 10, &rate->burst) < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("could not convert bandwidth burst value '%s'"), burst); - goto cleanup; + return -1; } =20 if (floor && virStrToLong_ullp(floor, NULL, 10, &rate->floor) < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("could not convert bandwidth floor value '%s'"), floor); - goto cleanup; + return -1; } =20 - ret =3D 0; - - cleanup: - return ret; + return 0; } =20 /** @@ -110,7 +106,6 @@ virNetDevBandwidthParse(virNetDevBandwidthPtr *bandwidt= h, xmlNodePtr node, bool allowFloor) { - int ret =3D -1; g_autoptr(virNetDevBandwidth) def =3D NULL; xmlNodePtr cur; xmlNodePtr in =3D NULL, out =3D NULL; @@ -121,7 +116,7 @@ virNetDevBandwidthParse(virNetDevBandwidthPtr *bandwidt= h, if (!node || !virXMLNodeNameEqual(node, "bandwidth")) { virReportError(VIR_ERR_INVALID_ARG, "%s", _("invalid argument supplied")); - goto cleanup; + return -1; } =20 class_id_prop =3D virXMLPropString(node, "classID"); @@ -130,13 +125,13 @@ virNetDevBandwidthParse(virNetDevBandwidthPtr *bandwi= dth, virReportError(VIR_ERR_XML_DETAIL, "%s", _("classID attribute not supported on " "in this usage context")); - goto cleanup; + return -1; } if (virStrToLong_ui(class_id_prop, NULL, 10, class_id) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Unable to parse class id '%s'"), class_id_prop); - goto cleanup; + return -1; } } =20 @@ -149,7 +144,7 @@ virNetDevBandwidthParse(virNetDevBandwidthPtr *bandwidt= h, virReportError(VIR_ERR_XML_DETAIL, "%s", _("Only one child " "element allowed")); - goto cleanup; + return -1; } in =3D cur; } else if (virXMLNodeNameEqual(cur, "outbound")) { @@ -157,7 +152,7 @@ virNetDevBandwidthParse(virNetDevBandwidthPtr *bandwidt= h, virReportError(VIR_ERR_XML_DETAIL, "%s", _("Only one child " "element allowed")); - goto cleanup; + return -1; } out =3D cur; } @@ -171,13 +166,13 @@ virNetDevBandwidthParse(virNetDevBandwidthPtr *bandwi= dth, =20 if (virNetDevBandwidthParseRate(in, def->in) < 0) { /* helper reported error for us */ - goto cleanup; + return -1; } =20 if (def->in->floor && !allowFloor) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("floor attribute is not supported for this co= nfig")); - goto cleanup; + return -1; } } =20 @@ -186,24 +181,21 @@ virNetDevBandwidthParse(virNetDevBandwidthPtr *bandwi= dth, =20 if (virNetDevBandwidthParseRate(out, def->out) < 0) { /* helper reported error for us */ - goto cleanup; + return -1; } =20 if (def->out->floor) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("'floor' attribute allowed " "only in element")); - goto cleanup; + return -1; } } =20 if (def->in || def->out) *bandwidth =3D g_steal_pointer(&def); =20 - ret =3D 0; - - cleanup: - return ret; + return 0; } =20 static int --=20 2.29.2