lkml.org 
[lkml]   [2022]   [Jul]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] kernel/sched/cputime: Fix unused value in cputime_adjust()
On Wed, Jul 20, 2022 at 06:29:56PM +0800, zengjx95@gmail.com wrote:
> From: Zeng Jingxiang <linuszeng@tencent.com>
>
> Coverity warns uf an unused value:
>
> assigned_value: Assign the value of the variable rtime to utime here,
> but that stored value is overwritten before it can be used.
> 568 if (stime == 0) {
> 569 utime = rtime;
> 570 goto update;
> 571 }
>
> value_overwrite: Overwriting previous write to utime with
> the value of expression rtime - stime.
> 592 utime = rtime - stime;

Coverity is being daft, the compiler has a dead-store-elimination pass.

This way the code is more consistent / easier to ready.

\
 
 \ /
  Last update: 2022-07-20 13:35    [W:0.059 / U:0.132 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site