linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sched/cputime: Remove unnecessary assignment statement
@ 2019-02-27  6:13 Ketan Patil
  2019-02-27 10:32 ` Peter Zijlstra
  0 siblings, 1 reply; 7+ messages in thread
From: Ketan Patil @ 2019-02-27  6:13 UTC (permalink / raw)
  To: mingo, peterz, linux-kernel
  Cc: linux-tegra, snikam, bnihalani, byan, sgurrappadi, treding,
	talho, Ketan Patil

The original code assigns the value from rtime to utime variable,
and then jumps to the update label. And the value of utime is then
updated, so the earlier value of utime is not used. Hence remove
that unnecessary assignment statement.

This fixes one of the coverity defects.

Based on work by Ishan Mittal <imittal@nvidia.com>

Signed-off-by: Ketan Patil <ketanp@nvidia.com>
---
 kernel/sched/cputime.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c
index ba4a143..ad64771 100644
--- a/kernel/sched/cputime.c
+++ b/kernel/sched/cputime.c
@@ -616,10 +616,8 @@ void cputime_adjust(struct task_cputime *curr, struct prev_cputime *prev,
 	 * Once a task gets some ticks, the monotonicy code at 'update:'
 	 * will ensure things converge to the observed ratio.
 	 */
-	if (stime == 0) {
-		utime = rtime;
+	if (stime == 0)
 		goto update;
-	}
 
 	if (utime == 0) {
 		stime = rtime;
-- 
2.7.4


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

end of thread, other threads:[~2019-02-28 13:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-27  6:13 [PATCH] sched/cputime: Remove unnecessary assignment statement Ketan Patil
2019-02-27 10:32 ` Peter Zijlstra
2019-02-28  9:42   ` Ketan Patil
2019-02-28  9:47     ` Peter Zijlstra
2019-02-28 12:14       ` Sachin Nikam
2019-02-28 12:31         ` Peter Zijlstra
2019-02-28 13:53           ` Jon Hunter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).