All of lore.kernel.org
 help / color / mirror / Atom feed
From: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
To: Keir Fraser <keir.fraser@eu.citrix.com>
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: [PATCH 2/2] small cleanup for domain_create()
Date: Fri, 07 May 2010 16:52:46 +0800	[thread overview]
Message-ID: <4BE3D4DE.4060500@cn.fujitsu.com> (raw)
In-Reply-To: <4BE3D48E.3010803@cn.fujitsu.com>

'struct domain' is always set to zero when it allocated, the only
exception is not defined 'CONFIG_IA64_PICKLE_DOMAIN' in ia64 architecture,
so we set it to zero in this case instead of in domain_create() function.

Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>

diff -r ccae861f52f7 -r 632487ba7f63 xen/arch/ia64/xen/domain.c
--- a/xen/arch/ia64/xen/domain.c	Thu May 06 11:59:55 2010 +0100
+++ b/xen/arch/ia64/xen/domain.c	Fri May 07 22:48:33 2010 +0800
@@ -407,20 +407,21 @@
 
 struct domain *alloc_domain_struct(void)
 {
+	struct domain *d;
 #ifdef CONFIG_IA64_PICKLE_DOMAIN
-	struct domain *d;
 	/*
 	 * We pack the MFN of the domain structure into a 32-bit field within
 	 * the page_info structure. Hence the MEMF_bits() restriction.
 	 */
 	d = alloc_xenheap_pages(get_order_from_bytes(sizeof(*d)),
 				MEMF_bits(32 + PAGE_SHIFT));
+#else
+	d = xmalloc(struct domain);
+#endif
+
 	if ( d != NULL )
 		memset(d, 0, sizeof(*d));
 	return d;
-#else
-	return xmalloc(struct domain);
-#endif
 }
 
 void free_domain_struct(struct domain *d)
diff -r ccae861f52f7 -r 632487ba7f63 xen/common/domain.c
--- a/xen/common/domain.c	Thu May 06 11:59:55 2010 +0100
+++ b/xen/common/domain.c	Fri May 07 22:48:33 2010 +0800
@@ -223,7 +223,6 @@
     if ( (d = alloc_domain_struct()) == NULL )
         return NULL;
 
-    memset(d, 0, sizeof(*d));
     d->domain_id = domid;
 
     lock_profile_register_struct(LOCKPROF_TYPE_PERDOM, d, domid, "Domain");

      reply	other threads:[~2010-05-07  8:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-07  8:51 [PATCH 1/2] x86: get the offset at compile time instead of raw value Xiao Guangrong
2010-05-07  8:52 ` Xiao Guangrong [this message]

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=4BE3D4DE.4060500@cn.fujitsu.com \
    --to=xiaoguangrong@cn.fujitsu.com \
    --cc=keir.fraser@eu.citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /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.