All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xen.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	Julien Grall <julien.grall@arm.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Jan Beulich <JBeulich@suse.com>
Subject: [PATCH 6/6] xen/domain: Use IS_ERR_OR_NULL() when checking the return value of domain_create()
Date: Wed, 28 Feb 2018 14:14:28 +0000	[thread overview]
Message-ID: <1519827268-18199-7-git-send-email-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <1519827268-18199-1-git-send-email-andrew.cooper3@citrix.com>

This means that hitting the fail path with with err set to 0 isn't considered
as success by the callers.  All current codepaths look fine.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Stefano Stabellini <sstabellini@kernel.org>
CC: Julien Grall <julien.grall@arm.com>
---
 xen/arch/arm/mm.c     | 6 +++---
 xen/arch/arm/setup.c  | 2 +-
 xen/arch/x86/mm.c     | 6 +++---
 xen/arch/x86/setup.c  | 2 +-
 xen/common/domctl.c   | 2 +-
 xen/common/schedule.c | 2 +-
 6 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 3c328e2..16a08cf 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -521,7 +521,7 @@ void __init arch_init_memory(void)
      * their domain field set to dom_xen.
      */
     dom_xen = domain_create(DOMID_XEN, DOMCRF_dummy, 0, NULL);
-    BUG_ON(IS_ERR(dom_xen));
+    BUG_ON(IS_ERR_OR_NULL(dom_xen));
 
     /*
      * Initialise our DOMID_IO domain.
@@ -529,14 +529,14 @@ void __init arch_init_memory(void)
      * array. Mappings occur at the priv of the caller.
      */
     dom_io = domain_create(DOMID_IO, DOMCRF_dummy, 0, NULL);
-    BUG_ON(IS_ERR(dom_io));
+    BUG_ON(IS_ERR_OR_NULL(dom_io));
 
     /*
      * Initialise our COW domain.
      * This domain owns sharable pages.
      */
     dom_cow = domain_create(DOMID_COW, DOMCRF_dummy, 0, NULL);
-    BUG_ON(IS_ERR(dom_cow));
+    BUG_ON(IS_ERR_OR_NULL(dom_cow));
 }
 
 static inline lpae_t pte_of_xenaddr(vaddr_t va)
diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 032a6a8..6646074 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -857,7 +857,7 @@ void __init start_xen(unsigned long boot_phys_offset,
     config.nr_spis = gic_number_lines() - 32;
 
     dom0 = domain_create(0, 0, 0, &config);
-    if ( IS_ERR(dom0) || (alloc_dom0_vcpu0(dom0) == NULL) )
+    if ( IS_ERR_OR_NULL(dom0) || (alloc_dom0_vcpu0(dom0) == NULL) )
             panic("Error creating domain 0");
 
     dom0->is_privileged = 1;
diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index e1f089b..c44b781 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -272,7 +272,7 @@ void __init arch_init_memory(void)
      * (but be [partly] controlled by Dom0 nevertheless).
      */
     dom_xen = domain_create(DOMID_XEN, DOMCRF_dummy, 0, NULL);
-    BUG_ON(IS_ERR(dom_xen));
+    BUG_ON(IS_ERR_OR_NULL(dom_xen));
     INIT_LIST_HEAD(&dom_xen->arch.pdev_list);
 
     /*
@@ -281,14 +281,14 @@ void __init arch_init_memory(void)
      * array. Mappings occur at the priv of the caller.
      */
     dom_io = domain_create(DOMID_IO, DOMCRF_dummy, 0, NULL);
-    BUG_ON(IS_ERR(dom_io));
+    BUG_ON(IS_ERR_OR_NULL(dom_io));
 
     /*
      * Initialise our COW domain.
      * This domain owns sharable pages.
      */
     dom_cow = domain_create(DOMID_COW, DOMCRF_dummy, 0, NULL);
-    BUG_ON(IS_ERR(dom_cow));
+    BUG_ON(IS_ERR_OR_NULL(dom_cow));
 
     /*
      * First 1MB of RAM is historically marked as I/O.  If we booted PVH,
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index ac530ec..92428da 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1640,7 +1640,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
 
     /* Create initial domain 0. */
     dom0 = domain_create(get_initial_domain_id(), domcr_flags, 0, &config);
-    if ( IS_ERR(dom0) || (alloc_dom0_vcpu0(dom0) == NULL) )
+    if ( IS_ERR_OR_NULL(dom0) || (alloc_dom0_vcpu0(dom0) == NULL) )
         panic("Error creating domain 0");
 
     if ( !pv_shim )
diff --git a/xen/common/domctl.c b/xen/common/domctl.c
index 50f7422..18dcb2d 100644
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -547,7 +547,7 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
 
         d = domain_create(dom, domcr_flags, op->u.createdomain.ssidref,
                           &op->u.createdomain.config);
-        if ( IS_ERR(d) )
+        if ( IS_ERR_OR_NULL(d) )
         {
             ret = PTR_ERR(d);
             d = NULL;
diff --git a/xen/common/schedule.c b/xen/common/schedule.c
index 64524f4..9c629a5 100644
--- a/xen/common/schedule.c
+++ b/xen/common/schedule.c
@@ -1735,7 +1735,7 @@ void __init scheduler_init(void)
     }
 
     idle_domain = domain_create(DOMID_IDLE, 0, 0, NULL);
-    BUG_ON(IS_ERR(idle_domain));
+    BUG_ON(IS_ERR_OR_NULL(idle_domain));
     idle_domain->vcpu = idle_vcpu;
     idle_domain->max_vcpus = nr_cpu_ids;
     if ( alloc_vcpu(idle_domain, 0, 0) == NULL )
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  parent reply	other threads:[~2018-02-28 14:14 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-28 14:14 [PATCH 0/6] Assorted improvements to domain creation Andrew Cooper
2018-02-28 14:14 ` [PATCH 1/6] xen/domain: Reduce the quantity of initialisation for system domains Andrew Cooper
2018-02-28 15:22   ` George Dunlap
2018-03-01 10:10   ` Dario Faggioli
2018-02-28 14:14 ` [PATCH 2/6] xen/credit2: Move repl_timer into struct csched2_dom Andrew Cooper
2018-02-28 15:26   ` George Dunlap
2018-03-01 10:12     ` Dario Faggioli
2018-02-28 14:14 ` [PATCH 3/6] xen/sched: Improvements to the {alloc, free}_domdata() interfaces Andrew Cooper
2018-02-28 15:40   ` George Dunlap
2018-02-28 16:31   ` Meng Xu
2018-03-01 10:39   ` Dario Faggioli
2018-03-05 18:20   ` Andrew Cooper
2018-02-28 14:14 ` [PATCH 4/6] xen/sched: Remove {init, destroy}_domain() interfaces Andrew Cooper
2018-02-28 16:22   ` George Dunlap
2018-02-28 16:33     ` Andrew Cooper
2018-03-01 11:08       ` Dario Faggioli
2018-02-28 16:34   ` Meng Xu
2018-03-01 11:00   ` Dario Faggioli
2018-02-28 14:14 ` [PATCH 5/6] xen/domain: Call sched_destroy_domain() in the domain_create() error path Andrew Cooper
2018-02-28 16:24   ` George Dunlap
2018-03-01 13:25   ` Dario Faggioli
2018-03-01 13:27   ` Dario Faggioli
2018-02-28 14:14 ` Andrew Cooper [this message]
2018-02-28 16:36   ` [PATCH 6/6] xen/domain: Use IS_ERR_OR_NULL() when checking the return value of domain_create() George Dunlap
2018-03-07 19:12   ` [PATCH v2 6/6] xen/domain: Added debug safety in the domain_create() failure path Andrew Cooper
2018-03-08  9:04     ` Jan Beulich

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=1519827268-18199-7-git-send-email-andrew.cooper3@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=julien.grall@arm.com \
    --cc=sstabellini@kernel.org \
    --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.