qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [6530] targets: remove error handling from qemu_malloc() callers ( Avi Kivity)
Date: Thu, 05 Feb 2009 22:06:11 +0000	[thread overview]
Message-ID: <E1LVCMN-0007hj-VB@cvs.savannah.gnu.org> (raw)

Revision: 6530
          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6530
Author:   aliguori
Date:     2009-02-05 22:06:11 +0000 (Thu, 05 Feb 2009)

Log Message:
-----------
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>

Modified Paths:
--------------
    trunk/target-alpha/translate.c
    trunk/target-arm/helper.c
    trunk/target-cris/translate.c
    trunk/target-i386/helper.c
    trunk/target-i386/kvm.c
    trunk/target-m68k/helper.c
    trunk/target-mips/translate.c
    trunk/target-ppc/helper.c
    trunk/target-ppc/kvm_ppc.c
    trunk/target-ppc/translate_init.c
    trunk/target-sh4/translate.c
    trunk/target-sparc/helper.c

Modified: trunk/target-alpha/translate.c
===================================================================
--- trunk/target-alpha/translate.c	2009-02-05 22:06:05 UTC (rev 6529)
+++ trunk/target-alpha/translate.c	2009-02-05 22:06:11 UTC (rev 6530)
@@ -2466,8 +2466,6 @@
     uint64_t hwpcb;
 
     env = qemu_mallocz(sizeof(CPUAlphaState));
-    if (!env)
-        return NULL;
     cpu_exec_init(env);
     alpha_translate_init();
     tlb_flush(env, 1);

Modified: trunk/target-arm/helper.c
===================================================================
--- trunk/target-arm/helper.c	2009-02-05 22:06:05 UTC (rev 6529)
+++ trunk/target-arm/helper.c	2009-02-05 22:06:11 UTC (rev 6530)
@@ -248,8 +248,6 @@
     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 @@
 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;

Modified: trunk/target-cris/translate.c
===================================================================
--- trunk/target-cris/translate.c	2009-02-05 22:06:05 UTC (rev 6529)
+++ trunk/target-cris/translate.c	2009-02-05 22:06:11 UTC (rev 6530)
@@ -3400,8 +3400,6 @@
 	int i;
 
 	env = qemu_mallocz(sizeof(CPUCRISState));
-	if (!env)
-		return NULL;
 
 	cpu_exec_init(env);
 	cpu_reset(env);

Modified: trunk/target-i386/helper.c
===================================================================
--- trunk/target-i386/helper.c	2009-02-05 22:06:05 UTC (rev 6529)
+++ trunk/target-i386/helper.c	2009-02-05 22:06:11 UTC (rev 6530)
@@ -1645,8 +1645,6 @@
     static int inited;
 
     env = qemu_mallocz(sizeof(CPUX86State));
-    if (!env)
-        return NULL;
     cpu_exec_init(env);
     env->cpu_model_str = cpu_model;
 

Modified: trunk/target-i386/kvm.c
===================================================================
--- trunk/target-i386/kvm.c	2009-02-05 22:06:05 UTC (rev 6529)
+++ trunk/target-i386/kvm.c	2009-02-05 22:06:11 UTC (rev 6530)
@@ -97,8 +97,6 @@
 
         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);

Modified: trunk/target-m68k/helper.c
===================================================================
--- trunk/target-m68k/helper.c	2009-02-05 22:06:05 UTC (rev 6529)
+++ trunk/target-m68k/helper.c	2009-02-05 22:06:11 UTC (rev 6530)
@@ -166,8 +166,6 @@
     static int inited;
 
     env = qemu_mallocz(sizeof(CPUM68KState));
-    if (!env)
-        return NULL;
     cpu_exec_init(env);
     if (!inited) {
         inited = 1;

Modified: trunk/target-mips/translate.c
===================================================================
--- trunk/target-mips/translate.c	2009-02-05 22:06:05 UTC (rev 6529)
+++ trunk/target-mips/translate.c	2009-02-05 22:06:11 UTC (rev 6530)
@@ -8476,8 +8476,6 @@
     if (!def)
         return NULL;
     env = qemu_mallocz(sizeof(CPUMIPSState));
-    if (!env)
-        return NULL;
     env->cpu_model = def;
 
     cpu_exec_init(env);

Modified: trunk/target-ppc/helper.c
===================================================================
--- trunk/target-ppc/helper.c	2009-02-05 22:06:05 UTC (rev 6529)
+++ trunk/target-ppc/helper.c	2009-02-05 22:06:11 UTC (rev 6530)
@@ -2761,8 +2761,6 @@
         return NULL;
 
     env = qemu_mallocz(sizeof(CPUPPCState));
-    if (!env)
-        return NULL;
     cpu_exec_init(env);
     ppc_translate_init();
     env->cpu_model_str = cpu_model;

Modified: trunk/target-ppc/kvm_ppc.c
===================================================================
--- trunk/target-ppc/kvm_ppc.c	2009-02-05 22:06:05 UTC (rev 6529)
+++ trunk/target-ppc/kvm_ppc.c	2009-02-05 22:06:11 UTC (rev 6530)
@@ -33,10 +33,6 @@
     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);
 

Modified: trunk/target-ppc/translate_init.c
===================================================================
--- trunk/target-ppc/translate_init.c	2009-02-05 22:06:05 UTC (rev 6529)
+++ trunk/target-ppc/translate_init.c	2009-02-05 22:06:11 UTC (rev 6530)
@@ -9040,8 +9040,6 @@
     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);
 

Modified: trunk/target-sh4/translate.c
===================================================================
--- trunk/target-sh4/translate.c	2009-02-05 22:06:05 UTC (rev 6529)
+++ trunk/target-sh4/translate.c	2009-02-05 22:06:11 UTC (rev 6530)
@@ -277,8 +277,6 @@
     if (!def)
 	return NULL;
     env = qemu_mallocz(sizeof(CPUSH4State));
-    if (!env)
-	return NULL;
     env->features = def->features;
     cpu_exec_init(env);
     sh4_translate_init();

Modified: trunk/target-sparc/helper.c
===================================================================
--- trunk/target-sparc/helper.c	2009-02-05 22:06:05 UTC (rev 6529)
+++ trunk/target-sparc/helper.c	2009-02-05 22:06:11 UTC (rev 6530)
@@ -713,8 +713,6 @@
     CPUSPARCState *env;
 
     env = qemu_mallocz(sizeof(CPUSPARCState));
-    if (!env)
-        return NULL;
     cpu_exec_init(env);
 
     gen_intermediate_code_init(env);

                 reply	other threads:[~2009-02-05 22:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=E1LVCMN-0007hj-VB@cvs.savannah.gnu.org \
    --to=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).