linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ketan Patil <ketanp@nvidia.com>
To: <mingo@redhat.com>, <peterz@infradead.org>,
	<linux-kernel@vger.kernel.org>
Cc: <linux-tegra@vger.kernel.org>, <snikam@nvidia.com>,
	<bnihalani@nvidia.com>, <byan@nvidia.com>,
	<sgurrappadi@nvidia.com>, <treding@nvidia.com>,
	<talho@nvidia.com>, Ketan Patil <ketanp@nvidia.com>
Subject: [PATCH] sched/cputime: Remove unnecessary assignment statement
Date: Wed, 27 Feb 2019 11:43:22 +0530	[thread overview]
Message-ID: <1551248002-27303-1-git-send-email-ketanp@nvidia.com> (raw)

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


             reply	other threads:[~2019-02-27  6:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-27  6:13 Ketan Patil [this message]
2019-02-27 10:32 ` [PATCH] sched/cputime: Remove unnecessary assignment statement 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1551248002-27303-1-git-send-email-ketanp@nvidia.com \
    --to=ketanp@nvidia.com \
    --cc=bnihalani@nvidia.com \
    --cc=byan@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=sgurrappadi@nvidia.com \
    --cc=snikam@nvidia.com \
    --cc=talho@nvidia.com \
    --cc=treding@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).