[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-trivial] [PATCH 56/88] PowerPC: use g_new() family of function
From: |
David Gibson |
Subject: |
Re: [Qemu-trivial] [PATCH 56/88] PowerPC: use g_new() family of functions |
Date: |
Sat, 7 Oct 2017 15:39:35 +1100 |
User-agent: |
Mutt/1.9.1 (2017-09-22) |
On Fri, Oct 06, 2017 at 08:49:51PM -0300, Philippe Mathieu-Daudé wrote:
> From: Marc-André Lureau <address@hidden>
>
> Signed-off-by: Marc-André Lureau <address@hidden>
> Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
> [PMD: one more change in target/ppc/translate_init.c, added
> target/ppc/kvm.c]
Acked-by: David Gibson <address@hidden>
> ---
> hw/ppc/ppc.c | 8 ++++----
> hw/ppc/ppc_booke.c | 4 ++--
> target/ppc/kvm.c | 2 +-
> target/ppc/translate_init.c | 14 +++++++-------
> 4 files changed, 14 insertions(+), 14 deletions(-)
>
> diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c
> index 05da316e0b..647d70fc13 100644
> --- a/hw/ppc/ppc.c
> +++ b/hw/ppc/ppc.c
> @@ -965,7 +965,7 @@ clk_setup_cb cpu_ppc_tb_init (CPUPPCState *env, uint32_t
> freq)
> PowerPCCPU *cpu = ppc_env_get_cpu(env);
> ppc_tb_t *tb_env;
>
> - tb_env = g_malloc0(sizeof(ppc_tb_t));
> + tb_env = g_new0(ppc_tb_t, 1);
> env->tb_env = tb_env;
> tb_env->flags = PPC_DECR_UNDERFLOW_TRIGGERED;
> if (env->insns_flags & PPC_SEGMENT_64B) {
> @@ -1224,10 +1224,10 @@ clk_setup_cb ppc_40x_timers_init (CPUPPCState *env,
> uint32_t freq,
> ppc_tb_t *tb_env;
> ppc40x_timer_t *ppc40x_timer;
>
> - tb_env = g_malloc0(sizeof(ppc_tb_t));
> + tb_env = g_new0(ppc_tb_t, 1);
> env->tb_env = tb_env;
> tb_env->flags = PPC_DECR_UNDERFLOW_TRIGGERED;
> - ppc40x_timer = g_malloc0(sizeof(ppc40x_timer_t));
> + ppc40x_timer = g_new0(ppc40x_timer_t, 1);
> tb_env->tb_freq = freq;
> tb_env->decr_freq = freq;
> tb_env->opaque = ppc40x_timer;
> @@ -1332,7 +1332,7 @@ int ppc_dcr_init (CPUPPCState *env, int
> (*read_error)(int dcrn),
> {
> ppc_dcr_t *dcr_env;
>
> - dcr_env = g_malloc0(sizeof(ppc_dcr_t));
> + dcr_env = g_new0(ppc_dcr_t, 1);
> dcr_env->read_error = read_error;
> dcr_env->write_error = write_error;
> env->dcr_env = dcr_env;
> diff --git a/hw/ppc/ppc_booke.c b/hw/ppc/ppc_booke.c
> index 23bcf1b138..dafc6aa3fc 100644
> --- a/hw/ppc/ppc_booke.c
> +++ b/hw/ppc/ppc_booke.c
> @@ -339,8 +339,8 @@ void ppc_booke_timers_init(PowerPCCPU *cpu, uint32_t
> freq, uint32_t flags)
> booke_timer_t *booke_timer;
> int ret = 0;
>
> - tb_env = g_malloc0(sizeof(ppc_tb_t));
> - booke_timer = g_malloc0(sizeof(booke_timer_t));
> + tb_env = g_new0(ppc_tb_t, 1);
> + booke_timer = g_new0(booke_timer_t, 1);
>
> cpu->env.tb_env = tb_env;
> tb_env->flags = flags | PPC_TIMER_BOOKE | PPC_DECR_ZERO_TRIGGERED;
> diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
> index 171d3d8040..d8565fd4a3 100644
> --- a/target/ppc/kvm.c
> +++ b/target/ppc/kvm.c
> @@ -364,7 +364,7 @@ struct ppc_radix_page_info *kvm_get_radix_page_info(void)
> if (kvm_vm_ioctl(s, KVM_PPC_GET_RMMU_INFO, &rmmu_info)) {
> return NULL;
> }
> - radix_page_info = g_malloc0(sizeof(*radix_page_info));
> + radix_page_info = g_new0(struct ppc_radix_page_info, 1);
> radix_page_info->count = 0;
> for (i = 0; i < PPC_PAGE_SIZES_MAX_SZ; i++) {
> if (rmmu_info.ap_encodings[i]) {
> diff --git a/target/ppc/translate_init.c b/target/ppc/translate_init.c
> index c6399a3a0d..850ff038ca 100644
> --- a/target/ppc/translate_init.c
> +++ b/target/ppc/translate_init.c
> @@ -9341,13 +9341,13 @@ static void init_ppc_proc(PowerPCCPU *cpu)
> nb_tlb *= 2;
> switch (env->tlb_type) {
> case TLB_6XX:
> - env->tlb.tlb6 = g_malloc0(nb_tlb * sizeof(ppc6xx_tlb_t));
> + env->tlb.tlb6 = g_new0(ppc6xx_tlb_t, nb_tlb);
> break;
> case TLB_EMB:
> - env->tlb.tlbe = g_malloc0(nb_tlb * sizeof(ppcemb_tlb_t));
> + env->tlb.tlbe = g_new0(ppcemb_tlb_t, nb_tlb);
> break;
> case TLB_MAS:
> - env->tlb.tlbm = g_malloc0(nb_tlb * sizeof(ppcmas_tlb_t));
> + env->tlb.tlbm = g_new0(ppcmas_tlb_t, nb_tlb);
> break;
> }
> /* Pre-compute some useful values */
> @@ -10442,11 +10442,11 @@ static void ppc_cpu_defs_entry(gpointer data,
> gpointer user_data)
> }
>
> typename = object_class_get_name(oc);
> - info = g_malloc0(sizeof(*info));
> + info = g_new0(CpuDefinitionInfo, 1);
> info->name = g_strndup(typename,
> strlen(typename) -
> strlen(POWERPC_CPU_TYPE_SUFFIX));
>
> - entry = g_malloc0(sizeof(*entry));
> + entry = g_new0(CpuDefinitionInfoList, 1);
> entry->value = info;
> entry->next = *first;
> *first = entry;
> @@ -10473,11 +10473,11 @@ CpuDefinitionInfoList
> *arch_query_cpu_definitions(Error **errp)
> continue;
> }
>
> - info = g_malloc0(sizeof(*info));
> + info = g_new0(CpuDefinitionInfo, 1);
> info->name = g_strdup(alias->alias);
> info->q_typename = g_strdup(object_class_get_name(oc));
>
> - entry = g_malloc0(sizeof(*entry));
> + entry = g_new0(CpuDefinitionInfoList, 1);
> entry->value = info;
> entry->next = cpu_list;
> cpu_list = entry;
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
signature.asc
Description: PGP signature
- [Qemu-trivial] [PATCH 51/88] hw/timer: use g_new() family of functions, (continued)
- [Qemu-trivial] [PATCH 51/88] hw/timer: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-trivial] [PATCH 52/88] i.MX31: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-trivial] [PATCH 53/88] iSCSI: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-trivial] [PATCH 54/88] KVM: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-trivial] [PATCH 55/88] PReP: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-trivial] [PATCH 56/88] PowerPC: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- Re: [Qemu-trivial] [PATCH 56/88] PowerPC: use g_new() family of functions,
David Gibson <=
- [Qemu-trivial] [PATCH 57/88] ppc: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-trivial] [PATCH 58/88] ppc4xx: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-trivial] [PATCH 59/88] ppce500: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-trivial] [PATCH 60/88] sPAPR: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-trivial] [PATCH 61/88] tests: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06