All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xen-devel] [PATCH] xen/cpupool: Fold error paths in cpupool_create()
@ 2020-01-06 17:37 Andrew Cooper
  2020-01-07  8:07 ` Jürgen Groß
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew Cooper @ 2020-01-06 17:37 UTC (permalink / raw)
  To: Xen-devel; +Cc: Juergen Gross, Andrew Cooper, Dario Faggioli

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@citrix.com>
---
CC: Juergen Gross <jgross@suse.com>
CC: Dario Faggioli <dfaggioli@suse.com>
---
 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
-- 
2.11.0


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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Xen-devel] [PATCH] xen/cpupool: Fold error paths in cpupool_create()
  2020-01-06 17:37 [Xen-devel] [PATCH] xen/cpupool: Fold error paths in cpupool_create() Andrew Cooper
@ 2020-01-07  8:07 ` Jürgen Groß
  0 siblings, 0 replies; 2+ messages in thread
From: Jürgen Groß @ 2020-01-07  8:07 UTC (permalink / raw)
  To: Andrew Cooper, Xen-devel; +Cc: Dario Faggioli

On 06.01.20 18:37, Andrew Cooper wrote:
> 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@citrix.com>

Reviewed-by: Juergen Gross <jgross@suse.com>


Juergen

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-01-07  8:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-06 17:37 [Xen-devel] [PATCH] xen/cpupool: Fold error paths in cpupool_create() Andrew Cooper
2020-01-07  8:07 ` Jürgen Groß

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.