All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tiejun Chen <tiejun.chen@intel.com>
To: wei.liu2@citrix.com, ian.campbell@citrix.com,
	stefano.stabellini@eu.citrix.com, ian.jackson@eu.citrix.com
Cc: xen-devel@lists.xen.org
Subject: [PATCH] tools/libxl: cleanup one libxl__calloc() usage
Date: Tue, 10 Mar 2015 14:28:16 +0800	[thread overview]
Message-ID: <1425968896-27199-1-git-send-email-tiejun.chen@intel.com> (raw)

Its pointless because internally, libxl__calloc() would always
terminate program execution if failed,

libxl__calloc()
    |
    + void *ptr = calloc(nmemb, size);
    + if (!ptr) libxl__alloc_failed(CTX, __func__, nmemb, size);
                    |
                    + _exit(-1);

Signed-off-by: Tiejun Chen <tiejun.chen@intel.com>
---
 tools/libxl/libxl_dm.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
index 8599a6a..cb006df 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -1175,10 +1175,6 @@ static void spawn_stub_launch_dm(libxl__egc *egc,
         num_console++;
 
     console = libxl__calloc(gc, num_console, sizeof(libxl__device_console));
-    if (!console) {
-        ret = ERROR_NOMEM;
-        goto out;
-    }
 
     for (i = 0; i < num_console; i++) {
         libxl__device device;
-- 
1.9.1

             reply	other threads:[~2015-03-10  6:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-10  6:28 Tiejun Chen [this message]
2015-03-10  9:21 ` [PATCH] tools/libxl: cleanup one libxl__calloc() usage Wei Liu
2015-03-11 12:30   ` Ian Campbell

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=1425968896-27199-1-git-send-email-tiejun.chen@intel.com \
    --to=tiejun.chen@intel.com \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.