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

[Xen-changelog] [xen staging] xen/cpupool: Fold error paths in cpupool_create()



commit c4f3fc12cd9706f7593016d4daf930cd50f0af32
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Fri Mar 29 16:51:12 2019 +0000
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Tue Jan 7 12:26:45 2020 +0000

    xen/cpupool: Fold error paths in cpupool_create()
    
    The compiler can't fold because of the write to *perr in the first hunk.
    
    No functional change, but slightly better compiled code.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Juergen Gross <jgross@xxxxxxxx>
---
 xen/common/cpupool.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/xen/common/cpupool.c b/xen/common/cpupool.c
index 4d3adbdd8d..d66b541a94 100644
--- a/xen/common/cpupool.c
+++ b/xen/common/cpupool.c
@@ -236,10 +236,8 @@ static struct cpupool *cpupool_create(
     {
         if ( (*q)->cpupool_id == poolid )
         {
-            spin_unlock(&cpupool_lock);
-            free_cpupool_struct(c);
             *perr = -EEXIST;
-            return NULL;
+            goto err;
         }
         c->next = *q;
     }
@@ -253,11 +251,7 @@ static struct cpupool *cpupool_create(
     {
         c->sched = scheduler_alloc(sched_id, perr);
         if ( c->sched == NULL )
-        {
-            spin_unlock(&cpupool_lock);
-            free_cpupool_struct(c);
-            return NULL;
-        }
+            goto err;
     }
     c->gran = opt_sched_granularity;
 
@@ -270,6 +264,11 @@ static struct cpupool *cpupool_create(
 
     *perr = 0;
     return c;
+
+ err:
+    spin_unlock(&cpupool_lock);
+    free_cpupool_struct(c);
+    return NULL;
 }
 /*
  * destroys the given cpupool
--
generated by git-patchbot for /home/xen/git/xen.git#staging

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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