Commit 0d0266a53b4c80ab08c093c36bb3a7bbb29cc3e5

Authored by aliguori
1 parent 487414f1

targets: remove error handling from qemu_malloc() callers (Avi Kivity)

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6530 c046a42c-6fe2-441c-8c8c-71466251a162
target-alpha/translate.c
... ... @@ -2466,8 +2466,6 @@ CPUAlphaState * cpu_alpha_init (const char *cpu_model)
2466 2466 uint64_t hwpcb;
2467 2467  
2468 2468 env = qemu_mallocz(sizeof(CPUAlphaState));
2469   - if (!env)
2470   - return NULL;
2471 2469 cpu_exec_init(env);
2472 2470 alpha_translate_init();
2473 2471 tlb_flush(env, 1);
... ...
target-arm/helper.c
... ... @@ -248,8 +248,6 @@ CPUARMState *cpu_arm_init(const char *cpu_model)
248 248 if (id == 0)
249 249 return NULL;
250 250 env = qemu_mallocz(sizeof(CPUARMState));
251   - if (!env)
252   - return NULL;
253 251 cpu_exec_init(env);
254 252 if (!inited) {
255 253 inited = 1;
... ... @@ -468,8 +466,6 @@ int cpu_arm_handle_mmu_fault (CPUState *env, target_ulong address, int rw,
468 466 static void allocate_mmon_state(CPUState *env)
469 467 {
470 468 env->mmon_entry = malloc(sizeof (mmon_state));
471   - if (!env->mmon_entry)
472   - abort();
473 469 memset (env->mmon_entry, 0, sizeof (mmon_state));
474 470 env->mmon_entry->cpu_env = env;
475 471 mmon_head = env->mmon_entry;
... ...
target-cris/translate.c
... ... @@ -3400,8 +3400,6 @@ CPUCRISState *cpu_cris_init (const char *cpu_model)
3400 3400 int i;
3401 3401  
3402 3402 env = qemu_mallocz(sizeof(CPUCRISState));
3403   - if (!env)
3404   - return NULL;
3405 3403  
3406 3404 cpu_exec_init(env);
3407 3405 cpu_reset(env);
... ...
target-i386/helper.c
... ... @@ -1645,8 +1645,6 @@ CPUX86State *cpu_x86_init(const char *cpu_model)
1645 1645 static int inited;
1646 1646  
1647 1647 env = qemu_mallocz(sizeof(CPUX86State));
1648   - if (!env)
1649   - return NULL;
1650 1648 cpu_exec_init(env);
1651 1649 env->cpu_model_str = cpu_model;
1652 1650  
... ...
target-i386/kvm.c
... ... @@ -97,8 +97,6 @@ static int kvm_has_msr_star(CPUState *env)
97 97  
98 98 kvm_msr_list = qemu_mallocz(sizeof(msr_list) +
99 99 msr_list.nmsrs * sizeof(msr_list.indices[0]));
100   - if (kvm_msr_list == NULL)
101   - return 0;
102 100  
103 101 kvm_msr_list->nmsrs = msr_list.nmsrs;
104 102 ret = kvm_ioctl(env->kvm_state, KVM_GET_MSR_INDEX_LIST, kvm_msr_list);
... ...
target-m68k/helper.c
... ... @@ -166,8 +166,6 @@ CPUM68KState *cpu_m68k_init(const char *cpu_model)
166 166 static int inited;
167 167  
168 168 env = qemu_mallocz(sizeof(CPUM68KState));
169   - if (!env)
170   - return NULL;
171 169 cpu_exec_init(env);
172 170 if (!inited) {
173 171 inited = 1;
... ...
target-mips/translate.c
... ... @@ -8476,8 +8476,6 @@ CPUMIPSState *cpu_mips_init (const char *cpu_model)
8476 8476 if (!def)
8477 8477 return NULL;
8478 8478 env = qemu_mallocz(sizeof(CPUMIPSState));
8479   - if (!env)
8480   - return NULL;
8481 8479 env->cpu_model = def;
8482 8480  
8483 8481 cpu_exec_init(env);
... ...
target-ppc/helper.c
... ... @@ -2761,8 +2761,6 @@ CPUPPCState *cpu_ppc_init (const char *cpu_model)
2761 2761 return NULL;
2762 2762  
2763 2763 env = qemu_mallocz(sizeof(CPUPPCState));
2764   - if (!env)
2765   - return NULL;
2766 2764 cpu_exec_init(env);
2767 2765 ppc_translate_init();
2768 2766 env->cpu_model_str = cpu_model;
... ...
target-ppc/kvm_ppc.c
... ... @@ -33,10 +33,6 @@ int kvmppc_read_host_property(const char *node_path, const char *prop,
33 33 pathlen = snprintf(NULL, 0, "%s/%s/%s", PROC_DEVTREE_PATH, node_path, prop)
34 34 + 1;
35 35 path = qemu_malloc(pathlen);
36   - if (path == NULL) {
37   - ret = -ENOMEM;
38   - goto out;
39   - }
40 36  
41 37 snprintf(path, pathlen, "%s/%s/%s", PROC_DEVTREE_PATH, node_path, prop);
42 38  
... ...
target-ppc/translate_init.c
... ... @@ -9040,8 +9040,6 @@ static int create_new_table (opc_handler_t **table, unsigned char idx)
9040 9040 opc_handler_t **tmp;
9041 9041  
9042 9042 tmp = malloc(0x20 * sizeof(opc_handler_t));
9043   - if (tmp == NULL)
9044   - return -1;
9045 9043 fill_new_table(tmp, 0x20);
9046 9044 table[idx] = (opc_handler_t *)((unsigned long)tmp | PPC_INDIRECT);
9047 9045  
... ...
target-sh4/translate.c
... ... @@ -277,8 +277,6 @@ CPUSH4State *cpu_sh4_init(const char *cpu_model)
277 277 if (!def)
278 278 return NULL;
279 279 env = qemu_mallocz(sizeof(CPUSH4State));
280   - if (!env)
281   - return NULL;
282 280 env->features = def->features;
283 281 cpu_exec_init(env);
284 282 sh4_translate_init();
... ...
target-sparc/helper.c
... ... @@ -713,8 +713,6 @@ CPUSPARCState *cpu_sparc_init(const char *cpu_model)
713 713 CPUSPARCState *env;
714 714  
715 715 env = qemu_mallocz(sizeof(CPUSPARCState));
716   - if (!env)
717   - return NULL;
718 716 cpu_exec_init(env);
719 717  
720 718 gen_intermediate_code_init(env);
... ...