[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <7hk158xzki.fsf@baylibre.com>
Date: Thu, 30 Jan 2020 16:02:53 -0800
From: Kevin Hilman <khilman@...libre.com>
To: Nathan Chancellor <natechancellor@...il.com>,
Niklas Cassel <niklas.cassel@...aro.org>
Cc: Andy Gross <agross@...nel.org>,
Bjorn Andersson <bjorn.andersson@...aro.org>,
Kevin Hilman <khilman@...nel.org>, Nishanth Menon <nm@...com>,
"Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
linux-pm@...r.kernel.org, linux-arm-msm@...r.kernel.org,
linux-kernel@...r.kernel.org, clang-built-linux@...glegroups.com,
Nathan Chancellor <natechancellor@...il.com>
Subject: Re: [PATCH] power: avs: qcom-cpr: Avoid clang -Wsometimes-uninitialized in cpr_scale
Nathan Chancellor <natechancellor@...il.com> writes:
> Clang warns (trimmed for brevity):
>
> ../drivers/power/avs/qcom-cpr.c:570:13: warning: variable 'reg_mask' is
> used uninitialized whenever 'if' condition is false
> [-Wsometimes-uninitialized]
>
> ../drivers/power/avs/qcom-cpr.c:520:13: warning: variable 'new_uV' is
> used uninitialized whenever 'if' condition is false
> [-Wsometimes-uninitialized]
>
> Due to the fact that Clang's static analysis happens before any
> optimization passes are taken into account, it cannot see that both
> branches in the if statement must be taken because dir cannot be
> something other than UP or DOWN due to the check at the top of this
> function. Change the else if condition to else to fix this false
> positive.
>
> Fixes: bf6910abf548 ("power: avs: Add support for CPR (Core Power Reduction)")
> Link: https://github.com/ClangBuiltLinux/linux/issues/840
> Signed-off-by: Nathan Chancellor <natechancellor@...il.com>
Acked-by: Kevin Hilman <khilman@...libre.com>
Rafael, feel free to queue directly.
Kevin
Powered by blists - more mailing lists