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