virDomainDefMaybeAddInput() returns nothing except 0. Changing return
type to void.
Found by Linux Verification Center (
linuxtesting.org) with SVACE.
Signed-off-by: Dmitry Frolov <frolov(a)swemel.ru>
---
src/conf/domain_conf.c | 6 ++----
src/conf/domain_conf.h | 2 +-
src/libxl/xen_common.c | 14 ++++++--------
src/vz/vz_driver.c | 15 ++++++---------
src/vz/vz_sdk.c | 14 ++++++--------
5 files changed, 21 insertions(+), 30 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index be57a1981e..fc785b188b 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -16227,7 +16227,7 @@ virDomainDefMaybeAddController(virDomainDef *def,
}
-int
+void
virDomainDefMaybeAddInput(virDomainDef *def,
int type,
int bus)
@@ -16238,7 +16238,7 @@ virDomainDefMaybeAddInput(virDomainDef *def,
for (i = 0; i < def->ninputs; i++) {
if (def->inputs[i]->type == type &&
def->inputs[i]->bus == bus)
- return 0;
+ return;
}
input = g_new0(virDomainInputDef, 1);
@@ -16247,8 +16247,6 @@ virDomainDefMaybeAddInput(virDomainDef *def,
input->bus = bus;
VIR_APPEND_ELEMENT(def->inputs, def->ninputs, input);
-
- return 0;
}
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index d176bda5f8..6a6f88e5af 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -4275,7 +4275,7 @@ virDomainDefMaybeAddController(virDomainDef *def,
virDomainControllerType type,
int idx,
int model);
-int
+void
virDomainDefMaybeAddInput(virDomainDef *def,
int type,
int bus);
diff --git a/src/libxl/xen_common.c b/src/libxl/xen_common.c
index d5a0399613..edb20127ab 100644
--- a/src/libxl/xen_common.c
+++ b/src/libxl/xen_common.c
@@ -2393,15 +2393,13 @@ xenDomainDefAddImplicitInputDevice(virDomainDef *def)
if (def->os.type == VIR_DOMAIN_OSTYPE_HVM)
implicitInputBus = VIR_DOMAIN_INPUT_BUS_PS2;
- if (virDomainDefMaybeAddInput(def,
- VIR_DOMAIN_INPUT_TYPE_MOUSE,
- implicitInputBus) < 0)
- return -1;
+ virDomainDefMaybeAddInput(def,
+ VIR_DOMAIN_INPUT_TYPE_MOUSE,
+ implicitInputBus);
- if (virDomainDefMaybeAddInput(def,
- VIR_DOMAIN_INPUT_TYPE_KBD,
- implicitInputBus) < 0)
- return -1;
+ virDomainDefMaybeAddInput(def,
+ VIR_DOMAIN_INPUT_TYPE_KBD,
+ implicitInputBus);
return 0;
}
diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c
index c7ceec2339..56b630bac0 100644
--- a/src/vz/vz_driver.c
+++ b/src/vz/vz_driver.c
@@ -219,16 +219,13 @@ vzDomainDefAddDefaultInputDevices(virDomainDef *def)
if (def->ngraphics == 0)
return 0;
- if (virDomainDefMaybeAddInput(def,
- VIR_DOMAIN_INPUT_TYPE_MOUSE,
- bus) < 0)
- return -1;
-
- if (virDomainDefMaybeAddInput(def,
- VIR_DOMAIN_INPUT_TYPE_KBD,
- bus) < 0)
- return -1;
+ virDomainDefMaybeAddInput(def,
+ VIR_DOMAIN_INPUT_TYPE_MOUSE,
+ bus);
+ virDomainDefMaybeAddInput(def,
+ VIR_DOMAIN_INPUT_TYPE_KBD,
+ bus);
return 0;
}
diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
index 6a15d60577..080beac351 100644
--- a/src/vz/vz_sdk.c
+++ b/src/vz/vz_sdk.c
@@ -1849,15 +1849,13 @@ prlsdkLoadDomain(struct _vzDriver *driver,
int bus = IS_CT(def) ? VIR_DOMAIN_INPUT_BUS_PARALLELS :
VIR_DOMAIN_INPUT_BUS_PS2;
- if (virDomainDefMaybeAddInput(def,
- VIR_DOMAIN_INPUT_TYPE_MOUSE,
- bus) < 0)
- return NULL;
+ virDomainDefMaybeAddInput(def,
+ VIR_DOMAIN_INPUT_TYPE_MOUSE,
+ bus);
- if (virDomainDefMaybeAddInput(def,
- VIR_DOMAIN_INPUT_TYPE_KBD,
- bus) < 0)
- return NULL;
+ virDomainDefMaybeAddInput(def,
+ VIR_DOMAIN_INPUT_TYPE_KBD,
+ bus);
}
if (!dom) {
--
2.34.1