Skip to contentSkip to conversation

sched: Fix pointless comparison between unsigned int with zero

PATCH New Liao Chang 1 participant 1 message Apr 6, 2022 Scheduler

lore
Share & tools
lore

Liao Chang

author
#0 lore raw

PATCH 1/1 sched: Fix pointless comparison between unsigned int with zero

It is pointless to do a comparison bewteen unsigned variable and zero, since validation routine requires the MSB of sysctl_sched_rt_period_ms is 0, so casting variable to signed value before comparing with zero.

---
 kernel/sched/rt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/rt.c +1 -1
index 7b4f4fbbb404..58e105180e67 100644
@@ -2906,7 +2906,7 @@ static int sched_rt_global_constraints(void)
 
 static int sched_rt_global_validate(void)
 {
-	if (sysctl_sched_rt_period <= 0)
+	if ((int)sysctl_sched_rt_period <= 0)
 		return -EINVAL;
 
 	if ((sysctl_sched_rt_runtime != RUNTIME_INF) &&
Signature · 1 line
2.17.1