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))) false)))
return -1; return -1;
if (virNetClientAddStream(priv->client, netst) < 0) { virNetClientAddStream(priv->client, netst);
virObjectUnref(netst);
return -1;
}
st->driver = &remoteStreamDrv; st->driver = &remoteStreamDrv;
st->privateData = netst; st->privateData = netst;
@ -6432,10 +6429,7 @@ remoteDomainMigratePrepareTunnel3Params(virConnectPtr dconn,
false))) false)))
goto cleanup; goto cleanup;
if (virNetClientAddStream(priv->client, netst) < 0) { virNetClientAddStream(priv->client, netst);
virObjectUnref(netst);
goto cleanup;
}
st->driver = &remoteStreamDrv; st->driver = &remoteStreamDrv;
st->privateData = netst; 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 " if (!(netst = virNetClientStreamNew(priv->remoteProgram, $call->{constname}, priv->counter, sparse)))\n";
print " goto cleanup;\n"; print " goto cleanup;\n";
print "\n"; print "\n";
print " if (virNetClientAddStream(priv->client, netst) < 0) {\n"; print " virNetClientAddStream(priv->client, netst);\n";
print " virObjectUnref(netst);\n";
print " goto cleanup;\n";
print " }";
print "\n"; print "\n";
print " st->driver = &remoteStreamDrv;\n"; print " st->driver = &remoteStreamDrv;\n";
print " st->privateData = netst;\n"; print " st->privateData = netst;\n";

View File

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

View File

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