lkml.org 
[lkml]   [2022]   [Apr]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] sched: Fix pointless comparison between unsigned int with zero
Date
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.

Signed-off-by: Liao Chang <liaochang1@huawei.com>
---
kernel/sched/rt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 7b4f4fbbb404..58e105180e67 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -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) &&
--
2.17.1
\
 
 \ /
  Last update: 2022-04-06 15:07    [W:0.068 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site