[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] tools/libs: Make xenforeignmemory_unmap_resource() idempotent



Most other close/unmap functions are.

Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
CC: Ian Jackson <Ian.Jackson@xxxxxxxxxx>
CC: Wei Liu <wei.liu2@xxxxxxxxxx>
CC: Paul Durrant <paul.durrant@xxxxxxxxxx>

This ideally wants backporting to 4.11 to hit 4.11.1

I got an unexpected shock while trying to diagnose why GVT-g is still
broken (differently!) on staging.
---
 tools/libs/foreignmemory/core.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tools/libs/foreignmemory/core.c b/tools/libs/foreignmemory/core.c
index 63f12e2..2516fd4 100644
--- a/tools/libs/foreignmemory/core.c
+++ b/tools/libs/foreignmemory/core.c
@@ -182,7 +182,12 @@ xenforeignmemory_resource_handle 
*xenforeignmemory_map_resource(
 int xenforeignmemory_unmap_resource(
     xenforeignmemory_handle *fmem, xenforeignmemory_resource_handle *fres)
 {
-    int rc = osdep_xenforeignmemory_unmap_resource(fmem, fres);
+    int rc;
+
+    if ( !fres )
+        return 0;
+
+    rc = osdep_xenforeignmemory_unmap_resource(fmem, fres);
 
     free(fres);
     return rc;
-- 
2.1.4


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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.