From: Avi Kivity <avi@redhat.com>
To: Anthony Liguori <anthony@codemonkey.ws>, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 5/6] targets: remove error handling from qemu_malloc() callers
Date: Thu, 5 Feb 2009 13:08:45 +0200 [thread overview]
Message-ID: <1233832126-9046-6-git-send-email-avi@redhat.com> (raw)
In-Reply-To: <1233832126-9046-1-git-send-email-avi@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
---
target-alpha/translate.c | 2 --
target-arm/helper.c | 4 ----
target-cris/translate.c | 2 --
target-i386/helper.c | 2 --
target-i386/kvm.c | 2 --
target-m68k/helper.c | 2 --
target-mips/translate.c | 2 --
target-ppc/helper.c | 2 --
target-ppc/kvm_ppc.c | 4 ----
target-ppc/translate_init.c | 2 --
target-sh4/translate.c | 2 --
target-sparc/helper.c | 2 --
12 files changed, 0 insertions(+), 28 deletions(-)
diff --git a/target-alpha/translate.c b/target-alpha/translate.c
index 3affb21..e27376d 100644
--- a/target-alpha/translate.c
+++ b/target-alpha/translate.c
@@ -2466,8 +2466,6 @@ CPUAlphaState * cpu_alpha_init (const char *cpu_model)
uint64_t hwpcb;
env = qemu_mallocz(sizeof(CPUAlphaState));
- if (!env)
- return NULL;
cpu_exec_init(env);
alpha_translate_init();
tlb_flush(env, 1);
diff --git a/target-arm/helper.c b/target-arm/helper.c
index 26fd6d0..3250fb8 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -248,8 +248,6 @@ CPUARMState *cpu_arm_init(const char *cpu_model)
if (id == 0)
return NULL;
env = qemu_mallocz(sizeof(CPUARMState));
- if (!env)
- return NULL;
cpu_exec_init(env);
if (!inited) {
inited = 1;
@@ -468,8 +466,6 @@ int cpu_arm_handle_mmu_fault (CPUState *env, target_ulong address, int rw,
static void allocate_mmon_state(CPUState *env)
{
env->mmon_entry = malloc(sizeof (mmon_state));
- if (!env->mmon_entry)
- abort();
memset (env->mmon_entry, 0, sizeof (mmon_state));
env->mmon_entry->cpu_env = env;
mmon_head = env->mmon_entry;
diff --git a/target-cris/translate.c b/target-cris/translate.c
index 288262d..f575e63 100644
--- a/target-cris/translate.c
+++ b/target-cris/translate.c
@@ -3400,8 +3400,6 @@ CPUCRISState *cpu_cris_init (const char *cpu_model)
int i;
env = qemu_mallocz(sizeof(CPUCRISState));
- if (!env)
- return NULL;
cpu_exec_init(env);
cpu_reset(env);
diff --git a/target-i386/helper.c b/target-i386/helper.c
index e55de96..5950c97 100644
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -1645,8 +1645,6 @@ CPUX86State *cpu_x86_init(const char *cpu_model)
static int inited;
env = qemu_mallocz(sizeof(CPUX86State));
- if (!env)
- return NULL;
cpu_exec_init(env);
env->cpu_model_str = cpu_model;
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index 49766e2..0834e62 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -97,8 +97,6 @@ static int kvm_has_msr_star(CPUState *env)
kvm_msr_list = qemu_mallocz(sizeof(msr_list) +
msr_list.nmsrs * sizeof(msr_list.indices[0]));
- if (kvm_msr_list == NULL)
- return 0;
kvm_msr_list->nmsrs = msr_list.nmsrs;
ret = kvm_ioctl(env->kvm_state, KVM_GET_MSR_INDEX_LIST, kvm_msr_list);
diff --git a/target-m68k/helper.c b/target-m68k/helper.c
index 076ea35..7eb21dd 100644
--- a/target-m68k/helper.c
+++ b/target-m68k/helper.c
@@ -166,8 +166,6 @@ CPUM68KState *cpu_m68k_init(const char *cpu_model)
static int inited;
env = qemu_mallocz(sizeof(CPUM68KState));
- if (!env)
- return NULL;
cpu_exec_init(env);
if (!inited) {
inited = 1;
diff --git a/target-mips/translate.c b/target-mips/translate.c
index b447b98..d659afb 100644
--- a/target-mips/translate.c
+++ b/target-mips/translate.c
@@ -8476,8 +8476,6 @@ CPUMIPSState *cpu_mips_init (const char *cpu_model)
if (!def)
return NULL;
env = qemu_mallocz(sizeof(CPUMIPSState));
- if (!env)
- return NULL;
env->cpu_model = def;
cpu_exec_init(env);
diff --git a/target-ppc/helper.c b/target-ppc/helper.c
index 3bd1d45..fc62a63 100644
--- a/target-ppc/helper.c
+++ b/target-ppc/helper.c
@@ -2761,8 +2761,6 @@ CPUPPCState *cpu_ppc_init (const char *cpu_model)
return NULL;
env = qemu_mallocz(sizeof(CPUPPCState));
- if (!env)
- return NULL;
cpu_exec_init(env);
ppc_translate_init();
env->cpu_model_str = cpu_model;
diff --git a/target-ppc/kvm_ppc.c b/target-ppc/kvm_ppc.c
index 82c0f42..10cfdb3 100644
--- a/target-ppc/kvm_ppc.c
+++ b/target-ppc/kvm_ppc.c
@@ -33,10 +33,6 @@ int kvmppc_read_host_property(const char *node_path, const char *prop,
pathlen = snprintf(NULL, 0, "%s/%s/%s", PROC_DEVTREE_PATH, node_path, prop)
+ 1;
path = qemu_malloc(pathlen);
- if (path == NULL) {
- ret = -ENOMEM;
- goto out;
- }
snprintf(path, pathlen, "%s/%s/%s", PROC_DEVTREE_PATH, node_path, prop);
diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
index 9570479..c808923 100644
--- a/target-ppc/translate_init.c
+++ b/target-ppc/translate_init.c
@@ -9040,8 +9040,6 @@ static int create_new_table (opc_handler_t **table, unsigned char idx)
opc_handler_t **tmp;
tmp = malloc(0x20 * sizeof(opc_handler_t));
- if (tmp == NULL)
- return -1;
fill_new_table(tmp, 0x20);
table[idx] = (opc_handler_t *)((unsigned long)tmp | PPC_INDIRECT);
diff --git a/target-sh4/translate.c b/target-sh4/translate.c
index 6c9dff5..80ea851 100644
--- a/target-sh4/translate.c
+++ b/target-sh4/translate.c
@@ -277,8 +277,6 @@ CPUSH4State *cpu_sh4_init(const char *cpu_model)
if (!def)
return NULL;
env = qemu_mallocz(sizeof(CPUSH4State));
- if (!env)
- return NULL;
env->features = def->features;
cpu_exec_init(env);
sh4_translate_init();
diff --git a/target-sparc/helper.c b/target-sparc/helper.c
index a275880..1a06525 100644
--- a/target-sparc/helper.c
+++ b/target-sparc/helper.c
@@ -713,8 +713,6 @@ CPUSPARCState *cpu_sparc_init(const char *cpu_model)
CPUSPARCState *env;
env = qemu_mallocz(sizeof(CPUSPARCState));
- if (!env)
- return NULL;
cpu_exec_init(env);
gen_intermediate_code_init(env);
--
1.6.1.1
next prev parent reply other threads:[~2009-02-05 11:08 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-05 11:08 [Qemu-devel] [PATCH 0/6] Unify memory allocation failure handling Avi Kivity
2009-02-05 11:08 ` [Qemu-devel] [PATCH 1/6] Terminate emulation on memory allocation failure Avi Kivity
2009-02-05 12:01 ` Daniel P. Berrange
2009-02-05 12:22 ` Avi Kivity
2009-02-05 17:43 ` Ian Jackson
2009-02-05 11:08 ` [Qemu-devel] [PATCH 2/6] block: remove error handling from qemu_malloc() callers Avi Kivity
2009-02-05 11:08 ` [Qemu-devel] [PATCH 3/6] audio: " Avi Kivity
2009-02-05 11:08 ` [Qemu-devel] [PATCH 4/6] hw: " Avi Kivity
2009-02-05 11:08 ` Avi Kivity [this message]
2009-02-05 11:08 ` [Qemu-devel] [PATCH 6/6] toplevel: " Avi Kivity
2009-02-05 17:43 ` [Qemu-devel] [PATCH 0/6] Unify memory allocation failure handling Ian Jackson
2009-02-05 22:07 ` [Qemu-devel] " Anthony Liguori
2009-02-06 8:47 ` Avi Kivity
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1233832126-9046-6-git-send-email-avi@redhat.com \
--to=avi@redhat.com \
--cc=anthony@codemonkey.ws \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).