mirror of
https://github.com/libvirt/libvirt.git
synced 2026-08-02 17:39:32 -05:00
virbitmap: Change return type of virBitmapToData to void
This function return value is invariant since e59b8f9, so change
its type and remove all dependent checks.
Found by Linux Verification Center (linuxtesting.org) with Svace.
Signed-off-by: Artem Chernyshev <artem.chernyshev@red-soft.ru>
Signed-off-by: Alexander Kuznetsov <kuznetsovam@altlinux.org>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
committed by
Jiri Denemark
parent
6387253c42
commit
8685923df0
+1
-4
@@ -1208,10 +1208,7 @@ virCHMonitorGetIOThreads(virCHMonitor *mon,
|
||||
if (!(map = virProcessGetAffinity(iothreadinfo->iothread_id)))
|
||||
goto error;
|
||||
|
||||
if (virBitmapToData(map, &(iothreadinfo->cpumap),
|
||||
&(iothreadinfo->cpumaplen)) < 0) {
|
||||
goto error;
|
||||
}
|
||||
virBitmapToData(map, &(iothreadinfo->cpumap), &(iothreadinfo->cpumaplen));
|
||||
|
||||
/* Append to iothreadinfolist */
|
||||
iothreadinfolist[niothreads] = g_steal_pointer(&iothreadinfo);
|
||||
|
||||
@@ -652,9 +652,7 @@ virDomainDriverGetIOThreadsConfig(virDomainDef *targetDef,
|
||||
cpumask = bitmap;
|
||||
}
|
||||
}
|
||||
if (virBitmapToData(cpumask, &info_ret[i]->cpumap,
|
||||
&info_ret[i]->cpumaplen) < 0)
|
||||
goto cleanup;
|
||||
virBitmapToData(cpumask, &info_ret[i]->cpumap, &info_ret[i]->cpumaplen);
|
||||
}
|
||||
|
||||
*info = g_steal_pointer(&info_ret);
|
||||
|
||||
@@ -4803,8 +4803,7 @@ qemuDomainGetIOThreadsLive(virDomainObj *vm,
|
||||
if (!(map = virProcessGetAffinity(iothreads[i]->thread_id)))
|
||||
goto endjob;
|
||||
|
||||
if (virBitmapToData(map, &info_ret[i]->cpumap, &info_ret[i]->cpumaplen) < 0)
|
||||
goto endjob;
|
||||
virBitmapToData(map, &info_ret[i]->cpumap, &info_ret[i]->cpumaplen);
|
||||
}
|
||||
|
||||
*info = g_steal_pointer(&info_ret);
|
||||
|
||||
@@ -637,10 +637,8 @@ virBitmapNewData(const void *data,
|
||||
* Convert a bitmap to a chunk of data containing bits information.
|
||||
* Data consists of sequential bytes, with lower bytes containing
|
||||
* lower bits. This function allocates @data.
|
||||
*
|
||||
* Returns 0 on success, -1 otherwise.
|
||||
*/
|
||||
int
|
||||
void
|
||||
virBitmapToData(virBitmap *bitmap,
|
||||
unsigned char **data,
|
||||
int *dataLen)
|
||||
@@ -656,8 +654,6 @@ virBitmapToData(virBitmap *bitmap,
|
||||
*dataLen = len;
|
||||
|
||||
virBitmapToDataBuf(bitmap, *data, *dataLen);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ virBitmap *virBitmapNewCopy(virBitmap *src) ATTRIBUTE_NONNULL(1);
|
||||
|
||||
virBitmap *virBitmapNewData(const void *data, int len) ATTRIBUTE_NONNULL(1);
|
||||
|
||||
int virBitmapToData(virBitmap *bitmap, unsigned char **data, int *dataLen)
|
||||
void virBitmapToData(virBitmap *bitmap, unsigned char **data, int *dataLen)
|
||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
|
||||
|
||||
void virBitmapToDataBuf(virBitmap *bitmap, unsigned char *data, size_t len)
|
||||
|
||||
@@ -1101,8 +1101,8 @@ virHostCPUGetMap(unsigned char **cpumap,
|
||||
if (!(cpus = virHostCPUGetOnlineBitmap()))
|
||||
goto cleanup;
|
||||
|
||||
if (cpumap && virBitmapToData(cpus, cpumap, &dummy) < 0)
|
||||
goto cleanup;
|
||||
if (cpumap)
|
||||
virBitmapToData(cpus, cpumap, &dummy);
|
||||
if (online)
|
||||
*online = virBitmapCountBits(cpus);
|
||||
|
||||
|
||||
@@ -339,8 +339,7 @@ test5(const void *v G_GNUC_UNUSED)
|
||||
ignore_value(virBitmapSetBit(bitmap, 2));
|
||||
ignore_value(virBitmapSetBit(bitmap, 15));
|
||||
|
||||
if (virBitmapToData(bitmap, &data2, &len2) < 0)
|
||||
return -1;
|
||||
virBitmapToData(bitmap, &data2, &len2);
|
||||
|
||||
if (len2 != sizeof(data) ||
|
||||
data2[0] != 0x05 ||
|
||||
|
||||
@@ -794,8 +794,7 @@ virshDomainVcpulistViaAgentCompleter(vshControl *ctl,
|
||||
if (!(onlineVcpus = virBitmapParseUnlimited(onlineVcpuStr)))
|
||||
goto cleanup;
|
||||
|
||||
if (virBitmapToData(onlineVcpus, &onlineVcpumap, &dummy) < 0)
|
||||
goto cleanup;
|
||||
virBitmapToData(onlineVcpus, &onlineVcpumap, &dummy);
|
||||
|
||||
if (enable) {
|
||||
offlinableVcpuStr = vshGetTypedParamValue(ctl, ¶ms[2]);
|
||||
@@ -803,8 +802,7 @@ virshDomainVcpulistViaAgentCompleter(vshControl *ctl,
|
||||
if (!(offlinableVcpus = virBitmapParseUnlimited(offlinableVcpuStr)))
|
||||
goto cleanup;
|
||||
|
||||
if (virBitmapToData(offlinableVcpus, &offlinableVcpumap, &dummy) < 0)
|
||||
goto cleanup;
|
||||
virBitmapToData(offlinableVcpus, &offlinableVcpumap, &dummy);
|
||||
|
||||
lastcpu = virBitmapLastSetBit(offlinableVcpus);
|
||||
cpulist = g_new0(char *, nvcpus - virBitmapCountBits(onlineVcpus) + 1);
|
||||
|
||||
@@ -7420,8 +7420,7 @@ virshParseCPUList(vshControl *ctl, int *cpumaplen,
|
||||
}
|
||||
}
|
||||
|
||||
if (virBitmapToData(map, &cpumap, cpumaplen) < 0)
|
||||
return NULL;
|
||||
virBitmapToData(map, &cpumap, cpumaplen);
|
||||
|
||||
return cpumap;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user