rpc: Change return type of virNetClientAddStream 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 <p.nekrasov@fobos-nt.ru>
Signed-off-by: Alexander Kuznetsov <kuznetsovam@altlinux.org>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
Alexander Kuznetsov 2024-11-28 18:21:20 +03:00 committed by Jiri Denemark
parent b0da352c58
commit f3179d5abe
4 changed files with 7 additions and 17 deletions

View File

@ -5663,10 +5663,7 @@ remoteDomainMigratePrepareTunnel3(virConnectPtr dconn,
false)))
return -1;
if (virNetClientAddStream(priv->client, netst) < 0) {
virObjectUnref(netst);
return -1;
}
virNetClientAddStream(priv->client, netst);
st->driver = &remoteStreamDrv;
st->privateData = netst;
@ -6432,10 +6429,7 @@ remoteDomainMigratePrepareTunnel3Params(virConnectPtr dconn,
false)))
goto cleanup;
if (virNetClientAddStream(priv->client, netst) < 0) {
virObjectUnref(netst);
goto cleanup;
}
virNetClientAddStream(priv->client, netst);
st->driver = &remoteStreamDrv;
st->privateData = netst;

View File

@ -1822,10 +1822,7 @@ elsif ($mode eq "client") {
print " if (!(netst = virNetClientStreamNew(priv->remoteProgram, $call->{constname}, priv->counter, sparse)))\n";
print " goto cleanup;\n";
print "\n";
print " if (virNetClientAddStream(priv->client, netst) < 0) {\n";
print " virObjectUnref(netst);\n";
print " goto cleanup;\n";
print " }";
print " virNetClientAddStream(priv->client, netst);\n";
print "\n";
print " st->driver = &remoteStreamDrv;\n";
print " st->privateData = netst;\n";

View File

@ -1065,7 +1065,7 @@ void virNetClientAddProgram(virNetClient *client,
}
int virNetClientAddStream(virNetClient *client,
void virNetClientAddStream(virNetClient *client,
virNetClientStream *st)
{
virObjectLock(client);
@ -1074,7 +1074,6 @@ int virNetClientAddStream(virNetClient *client,
client->streams[client->nstreams-1] = virObjectRef(st);
virObjectUnlock(client);
return 0;
}

View File

@ -120,7 +120,7 @@ bool virNetClientHasPassFD(virNetClient *client);
void virNetClientAddProgram(virNetClient *client,
virNetClientProgram *prog);
int virNetClientAddStream(virNetClient *client,
void virNetClientAddStream(virNetClient *client,
virNetClientStream *st);
void virNetClientRemoveStream(virNetClient *client,