From nobody Mon Feb 9 00:50:07 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1639052508; cv=none; d=zohomail.com; s=zohoarc; b=XCwEFuRMQ+H2eaO8VUIuLjpGc717O0XsmdK8rwPiO6BCyEPlOygomJrDTd89qK1lXhgDdYsBPuSf4GN5yk91BZsHPpquGKdIOBuExY4uhb19BZJ9IF32EUM3UgnBVNvyv/snbI4NAFsGVSOVvAtY88YJhmChxR4diOxS66EKeQ4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639052508; 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=EL7BKs/QTjRG7qx4ne9ol5ANtmdSAIP7LMIO0C3+Cr4=; b=igBGuAaZLwPAvzzxdI/6+mJCbbsVtEBUymuT+cl+iHq2FPKQLATbRiseE6J6d6T4QouHQRfrOJC1hjT6NT+tsAzqGjyjSpG0gjyccU13Jf6HuYVp0V+svZmi6oshxQaSzbLdwlvqxjTbx9K/0GXIEmLX1xmM7ZKRZT+p+0kH6xo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1639052508224400.0658614536121; Thu, 9 Dec 2021 04:21:48 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-495-25a-jKVsNcej-E8k7n9zYg-1; Thu, 09 Dec 2021 07:21:45 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E6BDE8710F1; Thu, 9 Dec 2021 12:21:39 +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 CA87410023AE; Thu, 9 Dec 2021 12:21:39 +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 9C5D14A705; Thu, 9 Dec 2021 12:21:39 +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 1B9CLcgk015365 for ; Thu, 9 Dec 2021 07:21:38 -0500 Received: by smtp.corp.redhat.com (Postfix) id CF7F95ED31; Thu, 9 Dec 2021 12:21:38 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 356F55ED2F for ; Thu, 9 Dec 2021 12:21:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639052507; 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=EL7BKs/QTjRG7qx4ne9ol5ANtmdSAIP7LMIO0C3+Cr4=; b=EDMWchaaNGsCJWT/MT55sL6qvDLjs3asydK1VfOzy5dH8D/p9hbm+6i/H6Rc3uGYx+rUgN 5BilBQlpgemOoQGwovHl2lO0hmJmIidZU4Nnn2shkfix1LQQIemewkKB2d/ByvlMDe+P49 fbQlZLPZ2H9+9mBATvgdH1OeGpRWPso= X-MC-Unique: 25a-jKVsNcej-E8k7n9zYg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 24/36] virBitmapSetBitExpand: Remove return value Date: Thu, 9 Dec 2021 13:18:29 +0100 Message-Id: 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.84 on 10.5.11.22 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-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1639052509856100001 Content-Type: text/plain; charset="utf-8" The function can't fail at this point. Remove the return value. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/numa_conf.c | 3 +-- src/network/bridge_driver.c | 3 +-- src/util/virbitmap.c | 14 ++++---------- src/util/virbitmap.h | 4 ++-- src/util/virhostcpu.c | 6 ++---- src/util/virqemu.c | 3 +-- src/util/virtpm.c | 3 +-- tests/testutils.c | 2 +- tests/virbitmaptest.c | 7 +++---- 9 files changed, 16 insertions(+), 29 deletions(-) diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c index 3bc1f63a5d..32821bf6a3 100644 --- a/src/conf/numa_conf.c +++ b/src/conf/numa_conf.c @@ -1149,8 +1149,7 @@ virDomainNumaDefValidate(const virDomainNuma *def) return -1; } - if (virBitmapSetBitExpand(levelsSeen, cache->level)) - return -1; + virBitmapSetBitExpand(levelsSeen, cache->level); } } diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 7e5fab630b..40dccf2c15 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -4966,8 +4966,7 @@ networkNextClassID(virNetworkObj *obj) if ((ret =3D virBitmapNextClearBit(classIdMap, -1)) < 0) ret =3D virBitmapSize(classIdMap); - if (virBitmapSetBitExpand(classIdMap, ret) < 0) - return -1; + virBitmapSetBitExpand(classIdMap, ret); return ret; } diff --git a/src/util/virbitmap.c b/src/util/virbitmap.c index ecc4b96a57..a3f674eb19 100644 --- a/src/util/virbitmap.c +++ b/src/util/virbitmap.c @@ -153,10 +153,8 @@ virBitmapExpand(virBitmap *map, * * Set bit position @b in @bitmap. Expands the bitmap as necessary so that= @b is * included in the map. - * - * Returns 0 on if bit is successfully set, -1 on error. */ -int +void virBitmapSetBitExpand(virBitmap *bitmap, size_t b) { @@ -164,7 +162,6 @@ virBitmapSetBitExpand(virBitmap *bitmap, virBitmapExpand(bitmap, b); bitmap->map[VIR_BITMAP_UNIT_OFFSET(b)] |=3D VIR_BITMAP_BIT(b); - return 0; } @@ -571,8 +568,7 @@ virBitmapParseUnlimited(const char *str) if (neg) { virBitmapClearBitExpand(bitmap, start); } else { - if (virBitmapSetBitExpand(bitmap, start) < 0) - goto error; + virBitmapSetBitExpand(bitmap, start); } } else if (*cur =3D=3D '-') { if (neg) @@ -588,10 +584,8 @@ virBitmapParseUnlimited(const char *str) cur =3D tmp; - for (i =3D start; i <=3D last; i++) { - if (virBitmapSetBitExpand(bitmap, i) < 0) - goto error; - } + for (i =3D start; i <=3D last; i++) + virBitmapSetBitExpand(bitmap, i); virSkipSpaces(&cur); } diff --git a/src/util/virbitmap.h b/src/util/virbitmap.h index 08ada97aa1..e2314904b0 100644 --- a/src/util/virbitmap.h +++ b/src/util/virbitmap.h @@ -44,8 +44,8 @@ void virBitmapFree(virBitmap *bitmap); int virBitmapSetBit(virBitmap *bitmap, size_t b) ATTRIBUTE_NONNULL(1) G_GNUC_WARN_UNUSED_RESULT; -int virBitmapSetBitExpand(virBitmap *bitmap, size_t b) - ATTRIBUTE_NONNULL(1) G_GNUC_WARN_UNUSED_RESULT; +void virBitmapSetBitExpand(virBitmap *bitmap, size_t b) + ATTRIBUTE_NONNULL(1); /* diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c index 1920184f61..83e3a5d0f1 100644 --- a/src/util/virhostcpu.c +++ b/src/util/virhostcpu.c @@ -336,8 +336,7 @@ virHostCPUParseNode(const char *node, if (virHostCPUGetSocket(cpu, &sock) < 0) goto cleanup; - if (virBitmapSetBitExpand(sockets_map, sock) < 0) - goto cleanup; + virBitmapSetBitExpand(sockets_map, sock); if (sock > sock_max) sock_max =3D sock; @@ -396,8 +395,7 @@ virHostCPUParseNode(const char *node, goto cleanup; } - if (virBitmapSetBitExpand(cores_maps[sock], core) < 0) - goto cleanup; + virBitmapSetBitExpand(cores_maps[sock], core); if (!(siblings =3D virHostCPUCountThreadSiblings(cpu))) goto cleanup; diff --git a/src/util/virqemu.c b/src/util/virqemu.c index aef6006dd7..8ff61b22b0 100644 --- a/src/util/virqemu.c +++ b/src/util/virqemu.c @@ -70,8 +70,7 @@ virQEMUBuildCommandLineJSONArrayBitmap(const char *key, if (virJSONValueGetNumberUlong(member, &value) < 0) return -1; - if (virBitmapSetBitExpand(bitmap, value) < 0) - return -1; + virBitmapSetBitExpand(bitmap, value); } while ((pos =3D virBitmapNextSetBit(bitmap, pos)) > -1) { diff --git a/src/util/virtpm.c b/src/util/virtpm.c index 63579b8e69..cf4c7c458f 100644 --- a/src/util/virtpm.c +++ b/src/util/virtpm.c @@ -251,8 +251,7 @@ virTPMExecGetCaps(virCommand *cmd, if (typ < 0) continue; - if (virBitmapSetBitExpand(bitmap, typ) < 0) - return bitmap; + virBitmapSetBitExpand(bitmap, typ); } return bitmap; diff --git a/tests/testutils.c b/tests/testutils.c index e460c9ecc5..65f02e0231 100644 --- a/tests/testutils.c +++ b/tests/testutils.c @@ -173,7 +173,7 @@ virTestRun(const char *title, } if (ret !=3D 0 && ret !=3D EXIT_AM_SKIP) - ignore_value(virBitmapSetBitExpand(failedTests, testCounter)); + virBitmapSetBitExpand(failedTests, testCounter); g_unsetenv("VIR_TEST_MOCK_TESTNAME"); return ret; diff --git a/tests/virbitmaptest.c b/tests/virbitmaptest.c index f16df4d2b2..89dc702da2 100644 --- a/tests/virbitmaptest.c +++ b/tests/virbitmaptest.c @@ -558,8 +558,7 @@ test12a(const void *opaque G_GNUC_UNUSED) if (checkBitmap(map, "", 0) < 0) return -1; - if (virBitmapSetBitExpand(map, 128) < 0) - return -1; + virBitmapSetBitExpand(map, 128); if (checkBitmap(map, "128", 129) < 0) return -1; @@ -692,8 +691,8 @@ test16(const void *opaque G_GNUC_UNUSED) return -1; } - ignore_value(virBitmapSetBitExpand(map, 2)); - ignore_value(virBitmapSetBitExpand(map, 11)); + virBitmapSetBitExpand(map, 2); + virBitmapSetBitExpand(map, 11); if (!(res_set =3D virBitmapToString(map)) || STRNEQ_NULLABLE(res_set, "804")) { --=20 2.31.1