From e60b7d773bff75e10ba4956b3d30ede8c3e5c536 Mon Sep 17 00:00:00 2001 From: ajesh Date: Mon, 26 Aug 2019 17:08:08 +0530 Subject: [PATCH] gpu: nvgpu: fix MISRA issues in cond unit Rule 10.1 Requires that operands shall not be of an inappropriate essential type. Rule 14.3 Requires that controlling expressions shall not be invariant. Rule 20.7 Requires that expressions resulting from the expansion of macro parameters shall be enclosed in parentheses. Fix violations of above rules in the macro defined in cond unit. Jira NVGPU-3878 Change-Id: Icd5758ae12210e68333c4ab820a36dc48c0aa29e Signed-off-by: ajesh Reviewed-on: https://git-master.nvidia.com/r/2183647 GVS: Gerrit_Virtual_Submit Reviewed-by: Philip Elcan Reviewed-by: Deepak Nibade Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/include/nvgpu/posix/cond.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/nvgpu/include/nvgpu/posix/cond.h b/drivers/gpu/nvgpu/include/nvgpu/posix/cond.h index 24a4c7092..12feecaa1 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/posix/cond.h +++ b/drivers/gpu/nvgpu/include/nvgpu/posix/cond.h @@ -55,8 +55,10 @@ void nvgpu_cond_unlock(struct nvgpu_cond *cond); #define NVGPU_COND_WAIT_LOCKED(cond, condition, timeout_ms) \ ({ \ int ret = 0; \ - NVGPU_COND_WAIT_TIMEOUT_LOCKED(cond, condition, ret, \ - timeout_ms ? timeout_ms : \ + u32 cond_timeout_ms = (timeout_ms); \ + NVGPU_COND_WAIT_TIMEOUT_LOCKED((cond), (condition), \ + (ret), \ + ((cond_timeout_ms) != 0U) ? (cond_timeout_ms) : \ NVGPU_COND_WAIT_TIMEOUT_MAX_MS); \ ret; \ })