aboutsummaryrefslogtreecommitdiffstats
path: root/litmus
diff options
context:
space:
mode:
authorBjoern B. Brandenburg <bbb@cs.unc.edu>2008-09-10 15:05:43 -0400
committerBjoern B. Brandenburg <bbb@cs.unc.edu>2008-09-11 14:33:40 -0400
commitad8edd22d871d2368389398bffcc417d569a693b (patch)
tree4d2ea5d795e727e246dfd5f505a34e80d86eeecb /litmus
parente9c5ff00452487d901f38286003a79e1dfab489a (diff)
edf_common: allow comparison of two NULL pointers
If the first argument to edf_higher_prio is NULL, then just return 0, since it can't possibly have a higher piority than the second argument.
Diffstat (limited to 'litmus')
-rw-r--r--litmus/edf_common.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/litmus/edf_common.c b/litmus/edf_common.c
index 253641de4f..84ece3e95e 100644
--- a/litmus/edf_common.c
+++ b/litmus/edf_common.c
@@ -18,8 +18,7 @@
18/* edf_higher_prio - returns true if first has a higher EDF priority 18/* edf_higher_prio - returns true if first has a higher EDF priority
19 * than second. Deadline ties are broken by PID. 19 * than second. Deadline ties are broken by PID.
20 * 20 *
21 * first first must not be NULL and a real-time task. 21 * both first and second may be NULL
22 * second may be NULL or a non-rt task.
23 */ 22 */
24int edf_higher_prio(struct task_struct* first, 23int edf_higher_prio(struct task_struct* first,
25 struct task_struct* second) 24 struct task_struct* second)
@@ -36,6 +35,8 @@ int edf_higher_prio(struct task_struct* first,
36 second_task = second->rt_param.inh_task; 35 second_task = second->rt_param.inh_task;
37 36
38 return 37 return
38 /* it has to exist in order to have higher priority */
39 first_task && (
39 /* does the second task exist and is it a real-time task? If 40 /* does the second task exist and is it a real-time task? If
40 * not, the first task (which is a RT task) has higher 41 * not, the first task (which is a RT task) has higher
41 * priority. 42 * priority.
@@ -57,7 +58,7 @@ int edf_higher_prio(struct task_struct* first,
57 * priority wins. 58 * priority wins.
58 */ 59 */
59 (first_task->pid == second_task->pid && 60 (first_task->pid == second_task->pid &&
60 !second->rt_param.inh_task))); 61 !second->rt_param.inh_task))));
61} 62}
62 63
63int edf_ready_order(struct heap_node* a, struct heap_node* b) 64int edf_ready_order(struct heap_node* a, struct heap_node* b)