On a Wednesday in 2024, Peter Krempa wrote:
The PCI VPD (Vital Product Data) may be missing or the kernel can report presence but not actually have the data. Also the data is specified by the device vendor and thus may be invalid in some cases. To avoid log spamming, since the only usage in the node device driver is ignoring errors, remove all error reporting. Closes: https://gitlab.com/libvirt/libvirt/-/issues/607 Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- src/conf/node_device_conf.c | 13 +++++------- src/libvirt_private.syms | 1 - src/util/virpci.c | 41 +++++++------------------------------ src/util/virpci.h | 1 - 4 files changed, 12 insertions(+), 44 deletions(-) diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index 48140b17ba..32b69aae84 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -3104,26 +3094,16 @@ virPCIVPDResource * virPCIDeviceGetVPD(virPCIDevice *dev) { g_autofree char *vpdPath = virPCIFile(dev->name, "vpd"); - virPCIVPDResource *ret = NULL; VIR_AUTOCLOSE fd = -1; - if (!virPCIDeviceHasVPD(dev)) { - virReportError(VIR_ERR_INTERNAL_ERROR, _("Device %1$s does not have a VPD"), - virPCIDeviceGetName(dev)); - return NULL; - } + fd = open(vpdPath, O_RDONLY); - if ((fd = open(vpdPath, O_RDONLY)) < 0) { - virReportSystemError(errno, _("Failed to open a VPD file '%1$s'"), vpdPath); - return NULL; - } + VIR_DEBUG("dev='%s' path='%s' fd='%d'", virPCIDeviceGetName(dev), vpdPath, fd); - if (!(ret = virPCIVPDParse(fd))) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Failed to parse device VPD data")); - return NULL; - } + if (fd < 0) + return 0;
This function returns a pointer. s/0/NULL/
- return ret; + return virPCIVPDParse(fd); } #else
Attachment:
signature.asc
Description: PGP signature
_______________________________________________ Devel mailing list -- devel@xxxxxxxxxxxxxxxxx To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx