* [PATCH] sched: remove redundant assignment to "rt_rq" in update_curr_rt(...)
@ 2014-05-25 14:23 Giedrius Rekasius
2019-05-11 13:18 ` [PATCH] sched: remove redundant assignment to variable utime Colin King
0 siblings, 1 reply; 3+ messages in thread
From: Giedrius Rekasius @ 2014-05-25 14:23 UTC (permalink / raw)
To: Ingo Molnar; +Cc: Peter Zijlstra, linux-kernel, kernel-janitors
Variable "rt_rq" is used only in block "for_each_sched_rt_entity" so the
value assigned to it at the beginning of the update_curr_rt(...) gets
overwritten without ever being read. Remove redundant assignment and
move variable declaration to the block in which it is being used.
Signed-off-by: Giedrius Rekasius <giedrius.rekasius@gmail.com>
---
kernel/sched/rt.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index bd2267a..7e0ea78 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -885,7 +885,6 @@ static void update_curr_rt(struct rq *rq)
{
struct task_struct *curr = rq->curr;
struct sched_rt_entity *rt_se = &curr->rt;
- struct rt_rq *rt_rq = rt_rq_of_se(rt_se);
u64 delta_exec;
if (curr->sched_class != &rt_sched_class)
@@ -910,7 +909,7 @@ static void update_curr_rt(struct rq *rq)
return;
for_each_sched_rt_entity(rt_se) {
- rt_rq = rt_rq_of_se(rt_se);
+ struct rt_rq *rt_rq = rt_rq_of_se(rt_se);
if (sched_rt_runtime(rt_rq) != RUNTIME_INF) {
raw_spin_lock(&rt_rq->rt_runtime_lock);
--
1.9.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] sched: remove redundant assignment to variable utime
2014-05-25 14:23 [PATCH] sched: remove redundant assignment to "rt_rq" in update_curr_rt(...) Giedrius Rekasius
@ 2019-05-11 13:18 ` Colin King
2019-05-13 7:55 ` Peter Zijlstra
0 siblings, 1 reply; 3+ messages in thread
From: Colin King @ 2019-05-11 13:18 UTC (permalink / raw)
To: Ingo Molnar, Peter Zijlstra; +Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
The variable utime is being assigned a value however this is never
read and later it is being reassigned to a new value. The assignment
is redundant and hence can be removed.
Addresses-Coverity: ("Unused Value")
Signed-off-by: Colin Ian King <colin.king@canonical.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 ba4a143bdcf3..ad647711ffb8 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.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] sched: remove redundant assignment to variable utime
2019-05-11 13:18 ` [PATCH] sched: remove redundant assignment to variable utime Colin King
@ 2019-05-13 7:55 ` Peter Zijlstra
0 siblings, 0 replies; 3+ messages in thread
From: Peter Zijlstra @ 2019-05-13 7:55 UTC (permalink / raw)
To: Colin King; +Cc: Ingo Molnar, kernel-janitors, linux-kernel
On Sat, May 11, 2019 at 02:18:49PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The variable utime is being assigned a value however this is never
> read and later it is being reassigned to a new value. The assignment
> is redundant and hence can be removed.
>
> Addresses-Coverity: ("Unused Value")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
Argh. not again.. still no.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-05-13 7:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-25 14:23 [PATCH] sched: remove redundant assignment to "rt_rq" in update_curr_rt(...) Giedrius Rekasius
2019-05-11 13:18 ` [PATCH] sched: remove redundant assignment to variable utime Colin King
2019-05-13 7:55 ` Peter Zijlstra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox