]> xenbits.xensource.com Git - xen.git/commitdiff
libxl: poll: Make libxl__poller_get have only one success return path
authorIan Jackson <ian.jackson@eu.citrix.com>
Thu, 9 Jul 2015 15:52:02 +0000 (16:52 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Wed, 12 Aug 2015 11:37:22 +0000 (12:37 +0100)
In preparation for doing some more work on successful exit.

No functional change.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
CC: Jim Fehlig <jfehlig@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Tested-by: Jim Fehlig <jfehlig@suse.com>
(cherry picked from commit 6fc946bc5520ebdbba5cbae4d49e53895df8b393)

(cherry picked from commit 8c409135e69c7321cb6d82b8cae0868a81d05ddc)
Conflicts:
tools/libxl/libxl_event.c
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/libxl/libxl_event.c

index 98cf565c3be0825efca8ce949ce0e25507202ec6..6111deb6f0eeb2de0ee23ff0a11ad39183592038 100644 (file)
@@ -1378,20 +1378,19 @@ libxl__poller *libxl__poller_get(libxl_ctx *ctx)
     libxl__poller *p = LIBXL_LIST_FIRST(&ctx->pollers_idle);
     if (p) {
         LIBXL_LIST_REMOVE(p, entry);
-        return p;
-    }
-
-    p = malloc(sizeof(*p));
-    if (!p) {
-        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "cannot allocate poller");
-        return 0;
-    }
-    memset(p, 0, sizeof(*p));
+    } else {
+        p = malloc(sizeof(*p));
+        if (!p) {
+            LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "cannot allocate poller");
+            return 0;
+        }
+        memset(p, 0, sizeof(*p));
 
-    rc = libxl__poller_init(ctx, p);
-    if (rc) {
-        free(p);
-        return NULL;
+        rc = libxl__poller_init(ctx, p);
+        if (rc) {
+            free(p);
+            return NULL;
+        }
     }
 
     return p;