From 393b0471a7376c5b4443e88f12fbba407e400510 Mon Sep 17 00:00:00 2001 From: Alexander Kuznetsov Date: Thu, 28 Nov 2024 18:21:17 +0300 Subject: [PATCH] access: Change return type of virAccessDriverStackAppend to void This function return value is invariant since VIR_EXPAND_N check removal in 7d2fd6e, so change its type and remove all dependent checks. Found by Linux Verification Center (linuxtesting.org) with Svace. Reported-by: Pavel Nekrasov Signed-off-by: Alexander Kuznetsov Reviewed-by: Jiri Denemark --- src/access/viraccessdriverstack.c | 6 ++---- src/access/viraccessdriverstack.h | 4 ++-- src/access/viraccessmanager.c | 5 +---- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/access/viraccessdriverstack.c b/src/access/viraccessdriverstack.c index fb9ea71665..d2702334e3 100644 --- a/src/access/viraccessdriverstack.c +++ b/src/access/viraccessdriverstack.c @@ -32,16 +32,14 @@ struct _virAccessDriverStackPrivate { }; -int virAccessDriverStackAppend(virAccessManager *manager, - virAccessManager *child) +void virAccessDriverStackAppend(virAccessManager *manager, + virAccessManager *child) { virAccessDriverStackPrivate *priv = virAccessManagerGetPrivateData(manager); VIR_EXPAND_N(priv->managers, priv->managersLen, 1); priv->managers[priv->managersLen-1] = child; - - return 0; } diff --git a/src/access/viraccessdriverstack.h b/src/access/viraccessdriverstack.h index abcfc30ec3..cabd56a5a7 100644 --- a/src/access/viraccessdriverstack.h +++ b/src/access/viraccessdriverstack.h @@ -23,7 +23,7 @@ #include "access/viraccessdriver.h" -int virAccessDriverStackAppend(virAccessManager *manager, - virAccessManager *child); +void virAccessDriverStackAppend(virAccessManager *manager, + virAccessManager *child); extern virAccessDriver accessDriverStack; diff --git a/src/access/viraccessmanager.c b/src/access/viraccessmanager.c index 481528c3b9..6d9fdee5f1 100644 --- a/src/access/viraccessmanager.c +++ b/src/access/viraccessmanager.c @@ -164,10 +164,7 @@ virAccessManager *virAccessManagerNewStack(const char **names) if (!child) goto error; - if (virAccessDriverStackAppend(manager, child) < 0) { - virObjectUnref(child); - goto error; - } + virAccessDriverStackAppend(manager, child); } return manager;