From 935fbcf9da8d86ad2aa07e2d84e9615b5a011136 Mon Sep 17 00:00:00 2001 From: Dmitrii Shcherbakov Date: Fri, 29 Oct 2021 21:57:18 +0300 Subject: [PATCH] PCI VPD: Fix a wrong return code in a test case MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The test case should return -1, not 0 in case a valid resource could not be parsed successfully but the ret value is initialized to 0. Reviewed-by: Daniel P. Berrangé Signed-off-by: Dmitrii Shcherbakov --- tests/virpcivpdtest.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/virpcivpdtest.c b/tests/virpcivpdtest.c index b7bc86d922..a9405f9427 100644 --- a/tests/virpcivpdtest.c +++ b/tests/virpcivpdtest.c @@ -537,7 +537,6 @@ testVirPCIVPDParseFullVPD(const void *opaque G_GNUC_UNUSED) { int fd = -1; size_t dataLen = 0; - int ret = 0; g_autoptr(virPCIVPDResource) res = NULL; /* Note: Custom fields are supposed to be freed by the resource cleanup code. */ @@ -558,7 +557,7 @@ testVirPCIVPDParseFullVPD(const void *opaque G_GNUC_UNUSED) if (!res) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", "The resource pointer is NULL after parsing which is unexpected"); - return ret; + return -1; } if (!res->ro) { @@ -596,7 +595,7 @@ testVirPCIVPDParseFullVPD(const void *opaque G_GNUC_UNUSED) return -1; custom = NULL; - return ret; + return 0; } static int