diff mbox

[for-next,v2,03/10] x86/domain: make release_compact_l4 NULL tolerant

Message ID 20170425135211.4696-4-wei.liu2@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Wei Liu April 25, 2017, 1:52 p.m. UTC
Push the check in caller down to that function so that it becomes
idempotent.

No functional change.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/domain.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Andrew Cooper April 25, 2017, 1:56 p.m. UTC | #1
On 25/04/17 14:52, Wei Liu wrote:
> Push the check in caller down to that function so that it becomes
> idempotent.
>
> No functional change.
>
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
diff mbox

Patch

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 1f76d034a7..b3d65b1f82 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -338,7 +338,8 @@  static int setup_compat_l4(struct vcpu *v)
 
 static void release_compat_l4(struct vcpu *v)
 {
-    free_domheap_page(pagetable_get_page(v->arch.guest_table));
+    if ( !pagetable_is_null(v->arch.guest_table) )
+        free_domheap_page(pagetable_get_page(v->arch.guest_table));
     v->arch.guest_table = pagetable_null();
     v->arch.guest_table_user = pagetable_null();
 }
@@ -379,9 +380,7 @@  int switch_compat(struct domain *d)
     for_each_vcpu( d, v )
     {
         free_compat_arg_xlat(v);
-
-        if ( !pagetable_is_null(v->arch.guest_table) )
-            release_compat_l4(v);
+        release_compat_l4(v);
     }
 
     return rc;