libvirt/libvirt-util-virpcivpd-Remo...

144 lines
5.5 KiB
Diff
Raw Normal View History

libvirt-10.0.0-3.el9 - remote_driver: Restore special behavior of remoteDomainGetBlockIoTune() (RHEL-22800) - conf: Introduce dynamicMemslots attribute for virtio-mem (RHEL-15316) - qemu_capabilities: Add QEMU_CAPS_DEVICE_VIRTIO_MEM_PCI_DYNAMIC_MEMSLOTS capability (RHEL-15316) - qemu_validate: Check capability for virtio-mem dynamicMemslots (RHEL-15316) - qemu_command: Generate cmd line for virtio-mem dynamicMemslots (RHEL-15316) - qemu_snapshot: fix detection if non-leaf snapshot isn't in active chain (RHEL-23212) - qemu_snapshot: create: refactor external snapshot detection (RHEL-22797) - qemu_snapshot: create: don't require disk-only flag for offline external snapshot (RHEL-22797) - remoteDispatchAuthPolkit: Fix lock ordering deadlock if client closes connection during auth (RHEL-20337) - util: virtportallocator: Add VIR_DEBUG statements for port allocations and release (RHEL-21543) - qemu: migration: Properly handle reservation of manually specified NBD port (RHEL-21543) - qemuMigrationDstStartNBDServer: Refactor cleanup (RHEL-21543) - virPCIVPDResourceIsValidTextValue: Adjust comment to reflect actual code (RHEL-22314) - util: pcivpd: Refactor virPCIVPDResourceIsValidTextValue (RHEL-22314) - virNodeDeviceCapVPDFormatCustom*: Escape unsanitized strings (RHEL-22314) - virNodeDeviceCapVPDFormat: Properly escape system-originated strings (RHEL-22314) - schema: nodedev: Adjust allowed characters in 'vpdFieldValueFormat' (RHEL-22314) - tests: Test the previously mishandled PCI VPD characters (RHEL-22314) - Don't overwrite error message from 'virXPathNodeSet' (RHEL-22314) - tests: virpcivpdtest: Remove 'testVirPCIVPDReadVPDBytes' case (RHEL-22314) - util: virpcivpd: Unexport 'virPCIVPDReadVPDBytes' (RHEL-22314) - util: pcivpd: Unexport virPCIVPDParseVPDLargeResourceFields (RHEL-22314) - tests: virpcivpd: Remove 'testVirPCIVPDParseVPDStringResource' case (RHEL-22314) - util: virpcivpd: Unexport 'virPCIVPDParseVPDLargeResourceString' (RHEL-22314) - virPCIVPDResourceGetKeywordPrefix: Fix logging (RHEL-22314) - util: virpcivpd: Remove return value from virPCIVPDResourceCustomUpsertValue (RHEL-22314) - conf: virNodeDeviceCapVPDParse*: Remove pointless NULL checks (RHEL-22314) - virpcivpdtest: testPCIVPDResourceBasic: Remove tests for uninitialized 'ro'/'rw' section (RHEL-22314) - util: virPCIVPDResourceUpdateKeyword: Remove impossible checks (RHEL-22314) - conf: node_device: Refactor 'virNodeDeviceCapVPDParseCustomFields' to fix error reporting (RHEL-22314) - virNodeDeviceCapVPDParseXML: Fix error reporting (RHEL-22314) - util: virpcivpd: Remove return value from virPCIVPDResourceUpdateKeyword (RHEL-22314) - virPCIDeviceHasVPD: Refactor "debug" messages (RHEL-22314) - virPCIDeviceGetVPD: Fix multiple error handling bugs (RHEL-22314) - virPCIDeviceGetVPD: Handle errors in callers (RHEL-22314) - virPCIVPDReadVPDBytes: Refactor error handling (RHEL-22314) - virPCIVPDParseVPDLargeResourceString: Properly report errors (RHEL-22314) - virPCIVPDParseVPDLargeResourceFields: Merge logic conditions (RHEL-22314) - virPCIVPDParseVPDLargeResourceFields: Remove impossible 'default' switch case (RHEL-22314) - virPCIVPDParseVPDLargeResourceFields: Refactor processing of read data (RHEL-22314) - virPCIVPDParseVPDLargeResourceFields: Refactor return logic (RHEL-22314) - virPCIVPDParseVPDLargeResourceFields: Report proper errors (RHEL-22314) - virPCIVPDParse: Do reasonable error reporting (RHEL-22314) - virt-admin: Add warning when connection to default daemon fails (RHEL-23170) Resolves: RHEL-15316, RHEL-20337, RHEL-21543, RHEL-22314, RHEL-22797 Resolves: RHEL-22800, RHEL-23170, RHEL-23212
2024-02-08 12:17:07 +00:00
From 509e56de7e817de1edbd76da806eb79dca6d45e3 Mon Sep 17 00:00:00 2001
Message-ID: <509e56de7e817de1edbd76da806eb79dca6d45e3.1707394627.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Wed, 24 Jan 2024 16:11:24 +0100
Subject: [PATCH] util: virpcivpd: Remove return value from
virPCIVPDResourceCustomUpsertValue
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
None of the callers pass NULL, so the NULL check is pointless. Remove it
an remove the return value.
The function is exported only for use in 'virpcivpdtest' thus marking
the arguments as NONNULL is unnecessary.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit d36da8ea4a107d129bdc701f95b1b131bc3df01d)
https://issues.redhat.com/browse/RHEL-22314 [9.4.0]
---
src/util/virpcivpd.c | 18 ++++--------------
src/util/virpcivpdpriv.h | 2 +-
tests/virpcivpdtest.c | 12 ++++--------
3 files changed, 9 insertions(+), 23 deletions(-)
diff --git a/src/util/virpcivpd.c b/src/util/virpcivpd.c
index 67065dec46..f198faaf42 100644
--- a/src/util/virpcivpd.c
+++ b/src/util/virpcivpd.c
@@ -270,7 +270,7 @@ virPCIVPDResourceCustomCompareIndex(virPCIVPDResourceCustom *a, virPCIVPDResourc
*
* Returns: true if a value has been updated successfully, false otherwise.
*/
-bool
+void
virPCIVPDResourceCustomUpsertValue(GPtrArray *arr, char index, const char *const value)
{
g_autoptr(virPCIVPDResourceCustom) custom = NULL;
@@ -278,9 +278,6 @@ virPCIVPDResourceCustomUpsertValue(GPtrArray *arr, char index, const char *const
guint pos = 0;
bool found = false;
- if (arr == NULL || value == NULL)
- return false;
-
custom = g_new0(virPCIVPDResourceCustom, 1);
custom->idx = index;
custom->value = g_strdup(value);
@@ -294,7 +291,6 @@ virPCIVPDResourceCustomUpsertValue(GPtrArray *arr, char index, const char *const
} else {
g_ptr_array_add(arr, g_steal_pointer(&custom));
}
- return true;
}
/**
@@ -348,9 +344,7 @@ virPCIVPDResourceUpdateKeyword(virPCIVPDResource *res, const bool readOnly,
res->ro->serial_number = g_strdup(value);
return true;
} else if (virPCIVPDResourceIsVendorKeyword(keyword)) {
- if (!virPCIVPDResourceCustomUpsertValue(res->ro->vendor_specific, keyword[1], value)) {
- return false;
- }
+ virPCIVPDResourceCustomUpsertValue(res->ro->vendor_specific, keyword[1], value);
return true;
} else if (STREQ("FG", keyword) || STREQ("LC", keyword) || STREQ("PG", keyword)) {
/* Legacy PICMIG keywords are skipped on purpose. */
@@ -371,14 +365,10 @@ virPCIVPDResourceUpdateKeyword(virPCIVPDResource *res, const bool readOnly,
res->rw->asset_tag = g_strdup(value);
return true;
} else if (virPCIVPDResourceIsVendorKeyword(keyword)) {
- if (!virPCIVPDResourceCustomUpsertValue(res->rw->vendor_specific, keyword[1], value)) {
- return false;
- }
+ virPCIVPDResourceCustomUpsertValue(res->rw->vendor_specific, keyword[1], value);
return true;
} else if (virPCIVPDResourceIsSystemKeyword(keyword)) {
- if (!virPCIVPDResourceCustomUpsertValue(res->rw->system_specific, keyword[1], value)) {
- return false;
- }
+ virPCIVPDResourceCustomUpsertValue(res->rw->system_specific, keyword[1], value);
return true;
}
}
diff --git a/src/util/virpcivpdpriv.h b/src/util/virpcivpdpriv.h
index 617991930b..f26b64139d 100644
--- a/src/util/virpcivpdpriv.h
+++ b/src/util/virpcivpdpriv.h
@@ -66,5 +66,5 @@ bool virPCIVPDResourceIsValidTextValue(const char *value);
gboolean
virPCIVPDResourceCustomCompareIndex(virPCIVPDResourceCustom *a, virPCIVPDResourceCustom *b);
-bool
+void
virPCIVPDResourceCustomUpsertValue(GPtrArray *arr, char index, const char *const value);
diff --git a/tests/virpcivpdtest.c b/tests/virpcivpdtest.c
index fddb42f52c..8a2f337e85 100644
--- a/tests/virpcivpdtest.c
+++ b/tests/virpcivpdtest.c
@@ -244,8 +244,7 @@ testPCIVPDResourceCustomUpsertValue(const void *data G_GNUC_UNUSED)
{
g_autoptr(GPtrArray) arr = g_ptr_array_new_full(0, (GDestroyNotify)virPCIVPDResourceCustomFree);
virPCIVPDResourceCustom *custom = NULL;
- if (!virPCIVPDResourceCustomUpsertValue(arr, 'A', "testval"))
- return -1;
+ virPCIVPDResourceCustomUpsertValue(arr, 'A', "testval");
if (arr->len != 1)
return -1;
@@ -255,8 +254,7 @@ testPCIVPDResourceCustomUpsertValue(const void *data G_GNUC_UNUSED)
return -1;
/* Idempotency */
- if (!virPCIVPDResourceCustomUpsertValue(arr, 'A', "testval"))
- return -1;
+ virPCIVPDResourceCustomUpsertValue(arr, 'A', "testval");
if (arr->len != 1)
return -1;
@@ -266,8 +264,7 @@ testPCIVPDResourceCustomUpsertValue(const void *data G_GNUC_UNUSED)
return -1;
/* Existing value updates. */
- if (!virPCIVPDResourceCustomUpsertValue(arr, 'A', "testvalnew"))
- return -1;
+ virPCIVPDResourceCustomUpsertValue(arr, 'A', "testvalnew");
if (arr->len != 1)
return -1;
@@ -277,8 +274,7 @@ testPCIVPDResourceCustomUpsertValue(const void *data G_GNUC_UNUSED)
return -1;
/* Inserting multiple values */
- if (!virPCIVPDResourceCustomUpsertValue(arr, '1', "42"))
- return -1;
+ virPCIVPDResourceCustomUpsertValue(arr, '1', "42");
if (arr->len != 2)
return -1;
--
2.43.0