mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
Merge tag 'pull-misc-2022-03-21' of git://repo.or.cz/qemu/armbru into staging
Miscellaneous patches patches for 2022-03-21 # gpg: Signature made Mon 21 Mar 2022 14:48:16 GMT # gpg: using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653 # gpg: issuer "armbru@redhat.com" # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full] # gpg: aka "Markus Armbruster <armbru@pond.sub.org>" [full] # Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653 * tag 'pull-misc-2022-03-21' of git://repo.or.cz/qemu/armbru: Use g_new() & friends where that makes obvious sense 9pfs: Use g_new() & friends where that makes obvious sense scripts/coccinelle: New use-g_new-etc.cocci block-qdict: Fix -Werror=maybe-uninitialized build failure Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
+3
-3
@@ -1646,7 +1646,7 @@ void kvm_memory_listener_register(KVMState *s, KVMMemoryListener *kml,
|
||||
{
|
||||
int i;
|
||||
|
||||
kml->slots = g_malloc0(s->nr_slots * sizeof(KVMSlot));
|
||||
kml->slots = g_new0(KVMSlot, s->nr_slots);
|
||||
kml->as_id = as_id;
|
||||
|
||||
for (i = 0; i < s->nr_slots; i++) {
|
||||
@@ -1941,7 +1941,7 @@ int kvm_irqchip_send_msi(KVMState *s, MSIMessage msg)
|
||||
return virq;
|
||||
}
|
||||
|
||||
route = g_malloc0(sizeof(KVMMSIRoute));
|
||||
route = g_new0(KVMMSIRoute, 1);
|
||||
route->kroute.gsi = virq;
|
||||
route->kroute.type = KVM_IRQ_ROUTING_MSI;
|
||||
route->kroute.flags = 0;
|
||||
@@ -3244,7 +3244,7 @@ int kvm_insert_breakpoint(CPUState *cpu, target_ulong addr,
|
||||
return 0;
|
||||
}
|
||||
|
||||
bp = g_malloc(sizeof(struct kvm_sw_breakpoint));
|
||||
bp = g_new(struct kvm_sw_breakpoint, 1);
|
||||
bp->pc = addr;
|
||||
bp->use_count = 1;
|
||||
err = kvm_arch_insert_sw_breakpoint(cpu, bp);
|
||||
|
||||
@@ -143,7 +143,7 @@ void mttcg_start_vcpu_thread(CPUState *cpu)
|
||||
g_assert(tcg_enabled());
|
||||
tcg_cpu_init_cflags(cpu, current_machine->smp.max_cpus > 1);
|
||||
|
||||
cpu->thread = g_malloc0(sizeof(QemuThread));
|
||||
cpu->thread = g_new0(QemuThread, 1);
|
||||
cpu->halt_cond = g_malloc0(sizeof(QemuCond));
|
||||
qemu_cond_init(cpu->halt_cond);
|
||||
|
||||
|
||||
@@ -280,8 +280,8 @@ void rr_start_vcpu_thread(CPUState *cpu)
|
||||
tcg_cpu_init_cflags(cpu, false);
|
||||
|
||||
if (!single_tcg_cpu_thread) {
|
||||
cpu->thread = g_malloc0(sizeof(QemuThread));
|
||||
cpu->halt_cond = g_malloc0(sizeof(QemuCond));
|
||||
cpu->thread = g_new0(QemuThread, 1);
|
||||
cpu->halt_cond = g_new0(QemuCond, 1);
|
||||
qemu_cond_init(cpu->halt_cond);
|
||||
|
||||
/* share a single thread for all cpus with TCG */
|
||||
|
||||
+2
-2
@@ -1733,7 +1733,7 @@ static AudioState *audio_init(Audiodev *dev, const char *name)
|
||||
audio_validate_opts(dev, &error_abort);
|
||||
}
|
||||
|
||||
s = g_malloc0(sizeof(AudioState));
|
||||
s = g_new0(AudioState, 1);
|
||||
s->dev = dev;
|
||||
|
||||
QLIST_INIT (&s->hw_head_out);
|
||||
@@ -2108,7 +2108,7 @@ void audio_parse_option(const char *opt)
|
||||
|
||||
audio_validate_opts(dev, &error_fatal);
|
||||
|
||||
e = g_malloc0(sizeof(AudiodevListEntry));
|
||||
e = g_new0(AudiodevListEntry, 1);
|
||||
e->dev = dev;
|
||||
QSIMPLEQ_INSERT_TAIL(&audiodevs, e, next);
|
||||
}
|
||||
|
||||
@@ -328,8 +328,8 @@ static void handle_per_direction(
|
||||
|
||||
static AudiodevListEntry *legacy_opt(const char *drvname)
|
||||
{
|
||||
AudiodevListEntry *e = g_malloc0(sizeof(AudiodevListEntry));
|
||||
e->dev = g_malloc0(sizeof(Audiodev));
|
||||
AudiodevListEntry *e = g_new0(AudiodevListEntry, 1);
|
||||
e->dev = g_new0(Audiodev, 1);
|
||||
e->dev->id = g_strdup(drvname);
|
||||
e->dev->driver = qapi_enum_parse(
|
||||
&AudiodevDriver_lookup, drvname, -1, &error_abort);
|
||||
@@ -508,7 +508,7 @@ static void lv_free(Visitor *v)
|
||||
|
||||
static Visitor *legacy_visitor_new(void)
|
||||
{
|
||||
LegacyPrintVisitor *lv = g_malloc0(sizeof(LegacyPrintVisitor));
|
||||
LegacyPrintVisitor *lv = g_new0(LegacyPrintVisitor, 1);
|
||||
|
||||
lv->visitor.start_struct = lv_start_struct;
|
||||
lv->visitor.end_struct = lv_end_struct;
|
||||
|
||||
+1
-1
@@ -623,7 +623,7 @@ static void *dsound_audio_init(Audiodev *dev)
|
||||
{
|
||||
int err;
|
||||
HRESULT hr;
|
||||
dsound *s = g_malloc0(sizeof(dsound));
|
||||
dsound *s = g_new0(dsound, 1);
|
||||
AudiodevDsoundOptions *dso;
|
||||
|
||||
assert(dev->driver == AUDIODEV_DRIVER_DSOUND);
|
||||
|
||||
+3
-3
@@ -97,9 +97,9 @@ static void qjack_buffer_create(QJackBuffer *buffer, int channels, int frames)
|
||||
buffer->used = 0;
|
||||
buffer->rptr = 0;
|
||||
buffer->wptr = 0;
|
||||
buffer->data = g_malloc(channels * sizeof(float *));
|
||||
buffer->data = g_new(float *, channels);
|
||||
for (int i = 0; i < channels; ++i) {
|
||||
buffer->data[i] = g_malloc(frames * sizeof(float));
|
||||
buffer->data[i] = g_new(float, frames);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -453,7 +453,7 @@ static int qjack_client_init(QJackClient *c)
|
||||
jack_on_shutdown(c->client, qjack_shutdown, c);
|
||||
|
||||
/* allocate and register the ports */
|
||||
c->port = g_malloc(sizeof(jack_port_t *) * c->nchannels);
|
||||
c->port = g_new(jack_port_t *, c->nchannels);
|
||||
for (int i = 0; i < c->nchannels; ++i) {
|
||||
|
||||
char port_name[16];
|
||||
|
||||
+2
-2
@@ -760,7 +760,7 @@ static int qpa_validate_per_direction_opts(Audiodev *dev,
|
||||
/* common */
|
||||
static void *qpa_conn_init(const char *server)
|
||||
{
|
||||
PAConnection *c = g_malloc0(sizeof(PAConnection));
|
||||
PAConnection *c = g_new0(PAConnection, 1);
|
||||
QTAILQ_INSERT_TAIL(&pa_conns, c, list);
|
||||
|
||||
c->mainloop = pa_threaded_mainloop_new();
|
||||
@@ -849,7 +849,7 @@ static void *qpa_audio_init(Audiodev *dev)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
g = g_malloc0(sizeof(paaudio));
|
||||
g = g_new0(paaudio, 1);
|
||||
server = popts->has_server ? popts->server : NULL;
|
||||
|
||||
g->dev = dev;
|
||||
|
||||
@@ -39,7 +39,7 @@ cryptodev_backend_new_client(const char *model,
|
||||
{
|
||||
CryptoDevBackendClient *cc;
|
||||
|
||||
cc = g_malloc0(sizeof(CryptoDevBackendClient));
|
||||
cc = g_new0(CryptoDevBackendClient, 1);
|
||||
cc->model = g_strdup(model);
|
||||
if (name) {
|
||||
cc->name = g_strdup(name);
|
||||
|
||||
@@ -455,7 +455,7 @@ vg_create_mapping_iov(VuGpu *g,
|
||||
return -1;
|
||||
}
|
||||
|
||||
*iov = g_malloc0(sizeof(struct iovec) * ab->nr_entries);
|
||||
*iov = g_new0(struct iovec, ab->nr_entries);
|
||||
for (i = 0; i < ab->nr_entries; i++) {
|
||||
uint64_t len = ents[i].length;
|
||||
(*iov)[i].iov_len = ents[i].length;
|
||||
|
||||
+2
-2
@@ -160,7 +160,7 @@ void async_run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data)
|
||||
{
|
||||
struct qemu_work_item *wi;
|
||||
|
||||
wi = g_malloc0(sizeof(struct qemu_work_item));
|
||||
wi = g_new0(struct qemu_work_item, 1);
|
||||
wi->func = func;
|
||||
wi->data = data;
|
||||
wi->free = true;
|
||||
@@ -305,7 +305,7 @@ void async_safe_run_on_cpu(CPUState *cpu, run_on_cpu_func func,
|
||||
{
|
||||
struct qemu_work_item *wi;
|
||||
|
||||
wi = g_malloc0(sizeof(struct qemu_work_item));
|
||||
wi = g_new0(struct qemu_work_item, 1);
|
||||
wi->func = func;
|
||||
wi->data = data;
|
||||
wi->free = true;
|
||||
|
||||
+1
-1
@@ -2041,7 +2041,7 @@ void qmp_dump_guest_memory(bool paging, const char *file,
|
||||
DumpGuestMemoryCapability *qmp_query_dump_guest_memory_capability(Error **errp)
|
||||
{
|
||||
DumpGuestMemoryCapability *cap =
|
||||
g_malloc0(sizeof(DumpGuestMemoryCapability));
|
||||
g_new0(DumpGuestMemoryCapability, 1);
|
||||
DumpGuestMemoryFormatList **tail = &cap->formats;
|
||||
|
||||
/* elf is always available */
|
||||
|
||||
+1
-1
@@ -1187,7 +1187,7 @@ static int proxy_parse_opts(QemuOpts *opts, FsDriverEntry *fs, Error **errp)
|
||||
|
||||
static int proxy_init(FsContext *ctx, Error **errp)
|
||||
{
|
||||
V9fsProxy *proxy = g_malloc(sizeof(V9fsProxy));
|
||||
V9fsProxy *proxy = g_new(V9fsProxy, 1);
|
||||
int sock_id;
|
||||
|
||||
if (ctx->export_flags & V9FS_PROXY_SOCK_NAME) {
|
||||
|
||||
+2
-2
@@ -49,7 +49,7 @@ static V9fsSynthNode *v9fs_add_dir_node(V9fsSynthNode *parent, int mode,
|
||||
|
||||
/* Add directory type and remove write bits */
|
||||
mode = ((mode & 0777) | S_IFDIR) & ~(S_IWUSR | S_IWGRP | S_IWOTH);
|
||||
node = g_malloc0(sizeof(V9fsSynthNode));
|
||||
node = g_new0(V9fsSynthNode, 1);
|
||||
if (attr) {
|
||||
/* We are adding .. or . entries */
|
||||
node->attr = attr;
|
||||
@@ -128,7 +128,7 @@ int qemu_v9fs_synth_add_file(V9fsSynthNode *parent, int mode,
|
||||
}
|
||||
/* Add file type and remove write bits */
|
||||
mode = ((mode & 0777) | S_IFREG);
|
||||
node = g_malloc0(sizeof(V9fsSynthNode));
|
||||
node = g_new0(V9fsSynthNode, 1);
|
||||
node->attr = &node->actual_attr;
|
||||
node->attr->inode = synth_node_count++;
|
||||
node->attr->nlink = 1;
|
||||
|
||||
+4
-4
@@ -324,7 +324,7 @@ static V9fsFidState *alloc_fid(V9fsState *s, int32_t fid)
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
f = g_malloc0(sizeof(V9fsFidState));
|
||||
f = g_new0(V9fsFidState, 1);
|
||||
f->fid = fid;
|
||||
f->fid_type = P9_FID_NONE;
|
||||
f->ref = 1;
|
||||
@@ -804,7 +804,7 @@ static int qid_inode_prefix_hash_bits(V9fsPDU *pdu, dev_t dev)
|
||||
|
||||
val = qht_lookup(&pdu->s->qpd_table, &lookup, hash);
|
||||
if (!val) {
|
||||
val = g_malloc0(sizeof(QpdEntry));
|
||||
val = g_new0(QpdEntry, 1);
|
||||
*val = lookup;
|
||||
affix = affixForIndex(pdu->s->qp_affix_next);
|
||||
val->prefix_bits = affix.bits;
|
||||
@@ -852,7 +852,7 @@ static int qid_path_fullmap(V9fsPDU *pdu, const struct stat *stbuf,
|
||||
return -ENFILE;
|
||||
}
|
||||
|
||||
val = g_malloc0(sizeof(QppEntry));
|
||||
val = g_new0(QpfEntry, 1);
|
||||
*val = lookup;
|
||||
|
||||
/* new unique inode and device combo */
|
||||
@@ -928,7 +928,7 @@ static int qid_path_suffixmap(V9fsPDU *pdu, const struct stat *stbuf,
|
||||
return -ENFILE;
|
||||
}
|
||||
|
||||
val = g_malloc0(sizeof(QppEntry));
|
||||
val = g_new0(QppEntry, 1);
|
||||
*val = lookup;
|
||||
|
||||
/* new unique inode affix and device combo */
|
||||
|
||||
+3
-3
@@ -141,9 +141,9 @@ static int do_readdir_many(V9fsPDU *pdu, V9fsFidState *fidp,
|
||||
|
||||
/* append next node to result chain */
|
||||
if (!e) {
|
||||
*entries = e = g_malloc0(sizeof(V9fsDirEnt));
|
||||
*entries = e = g_new0(V9fsDirEnt, 1);
|
||||
} else {
|
||||
e = e->next = g_malloc0(sizeof(V9fsDirEnt));
|
||||
e = e->next = g_new0(V9fsDirEnt, 1);
|
||||
}
|
||||
e->dent = qemu_dirent_dup(dent);
|
||||
|
||||
@@ -163,7 +163,7 @@ static int do_readdir_many(V9fsPDU *pdu, V9fsFidState *fidp,
|
||||
break;
|
||||
}
|
||||
|
||||
e->st = g_malloc0(sizeof(struct stat));
|
||||
e->st = g_new0(struct stat, 1);
|
||||
memcpy(e->st, &stbuf, sizeof(struct stat));
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -128,7 +128,7 @@ static void build_hmat_lb(GArray *table_data, HMAT_LB_Info *hmat_lb,
|
||||
}
|
||||
|
||||
/* Latency or Bandwidth Entries */
|
||||
entry_list = g_malloc0(num_initiator * num_target * sizeof(uint16_t));
|
||||
entry_list = g_new0(uint16_t, num_initiator * num_target);
|
||||
for (i = 0; i < hmat_lb->list->len; i++) {
|
||||
lb_data = &g_array_index(hmat_lb->list, HMAT_LB_Data, i);
|
||||
index = lb_data->initiator * num_target + lb_data->target;
|
||||
|
||||
@@ -473,7 +473,7 @@ static void intel_hda_parse_bdl(IntelHDAState *d, IntelHDAStream *st)
|
||||
addr = intel_hda_addr(st->bdlp_lbase, st->bdlp_ubase);
|
||||
st->bentries = st->lvi +1;
|
||||
g_free(st->bpl);
|
||||
st->bpl = g_malloc(sizeof(bpl) * st->bentries);
|
||||
st->bpl = g_new(bpl, st->bentries);
|
||||
for (i = 0; i < st->bentries; i++, addr += 16) {
|
||||
pci_dma_read(&d->pci, addr, buf, 16);
|
||||
st->bpl[i].addr = le64_to_cpu(*(uint64_t *)buf);
|
||||
|
||||
+1
-1
@@ -622,7 +622,7 @@ bool parallel_mm_init(MemoryRegion *address_space,
|
||||
{
|
||||
ParallelState *s;
|
||||
|
||||
s = g_malloc0(sizeof(ParallelState));
|
||||
s = g_new0(ParallelState, 1);
|
||||
s->irq = irq;
|
||||
qemu_chr_fe_init(&s->chr, chr, &error_abort);
|
||||
s->it_shift = it_shift;
|
||||
|
||||
@@ -248,7 +248,7 @@ HTIFState *htif_mm_init(MemoryRegion *address_space, MemoryRegion *main_mem,
|
||||
tohost_offset = tohost_addr - base;
|
||||
fromhost_offset = fromhost_addr - base;
|
||||
|
||||
HTIFState *s = g_malloc0(sizeof(HTIFState));
|
||||
HTIFState *s = g_new0(HTIFState, 1);
|
||||
s->address_space = address_space;
|
||||
s->main_mem = main_mem;
|
||||
s->main_mem_ram_ptr = memory_region_get_ram_ptr(main_mem);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user