]> xenbits.xensource.com Git - xen.git/commitdiff
xen: credit: change an ASSERT on nr_runnable so that it makes sense.
authorDario Faggioli <dario.faggioli@citrix.com>
Thu, 13 Apr 2017 07:49:54 +0000 (09:49 +0200)
committerGeorge Dunlap <george.dunlap@citrix.com>
Thu, 13 Apr 2017 14:10:54 +0000 (15:10 +0100)
Since the counter is unsigned, it's pointless/bogous to check
for if to be above zero.

Check that it is at least one before it's decremented, instead.

Spotted by Coverity.

Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Reviewed-by: George Dunlap <george.dunlap@citrix.com>
Release-acked-by: Julien Grall <julien.grall@arm.com>
xen/common/sched_credit.c

index 93658dcfe533ee9803147b78a99407afee66d899..efdf6bf2f362bebae5889a169de252c788eb73f9 100644 (file)
@@ -275,8 +275,8 @@ static inline void
 dec_nr_runnable(unsigned int cpu)
 {
     ASSERT(spin_is_locked(per_cpu(schedule_data, cpu).schedule_lock));
+    ASSERT(CSCHED_PCPU(cpu)->nr_runnable >= 1);
     CSCHED_PCPU(cpu)->nr_runnable--;
-    ASSERT(CSCHED_PCPU(cpu)->nr_runnable >= 0);
 }
 
 static inline void