mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 10:34:43 +03:00
gpu: nvgpu: Cast unsigned arith to signed for abs()
Before passing in an unsigned value to abs() cast the result of the subtraction to signed. In Linux this happens automatically but on non-Linux platforms abs() does not necessarily do this. clang flags this case as a pointless operation: abs(x) obviously must equal x for any unsigned x. This change should hopefully preserve the Linux behavior but avoid the compiler warning from clang. JIRA NVGPU-525 Change-Id: I71320964c0922f1e4890c8b25d801f17e54ed3c0 Signed-off-by: Alex Waterman <alexw@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1724093 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: Aleksandr Frid <afrid@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
2788943d38
commit
ee9d9b0cd2
@@ -204,7 +204,7 @@ static int clk_config_pll(struct clk_gk20a *clk, struct pll *pll,
|
||||
if (vco_f >= min_vco_f && vco_f <= max_vco_f) {
|
||||
lwv = (vco_f + (nvgpu_pl_to_div(pl) / 2))
|
||||
/ nvgpu_pl_to_div(pl);
|
||||
delta = abs(lwv - target_clk_f);
|
||||
delta = abs((s32)(lwv - target_clk_f));
|
||||
|
||||
if (delta < best_delta) {
|
||||
best_delta = delta;
|
||||
|
||||
Reference in New Issue
Block a user