From cc2e1be0bb439ba560c9d2afc814e40675a71599 Mon Sep 17 00:00:00 2001 From: Terje Bergstrom Date: Wed, 25 Mar 2020 10:41:15 -0700 Subject: [PATCH] gpu: nvgpu: unit: atomic: Use labs when operating on long Use labs() instead of abs() when operating with longs. Change-Id: Ibb1f2c69099387478b41b66cf68539b460bc2be3 Signed-off-by: Terje Bergstrom Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2318390 Reviewed-by: automaticguardword Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-misra Reviewed-by: Alex Waterman Reviewed-by: mobile promotions GVS: Gerrit_Virtual_Submit Tested-by: mobile promotions --- userspace/units/interface/atomic/atomic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/userspace/units/interface/atomic/atomic.c b/userspace/units/interface/atomic/atomic.c index d7dbdd044..6788d3fef 100644 --- a/userspace/units/interface/atomic/atomic.c +++ b/userspace/units/interface/atomic/atomic.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -775,7 +775,7 @@ int test_atomic_arithmetic_threaded(struct unit_module *m, /* sanity test that the threads aren't all sequential */ bool sequential = true; for (i = 0; i < (num_threads - 1); i++) { - if (abs(threads[i].final_val - threads[i+1].final_val) + if (labs(threads[i].final_val - threads[i+1].final_val) != (long)args->loop_count) { sequential = false; break;