From 72fc890f5191dd48bb02c42e863e255a097ed25b Mon Sep 17 00:00:00 2001 From: Sagar Kamble Date: Mon, 21 Oct 2019 14:28:25 +0530 Subject: [PATCH] gpu: nvgpu: fix MISRA 5.3 violations Fix violations of MISRA 5.3 introduced by updated implementation of nvgpu_timeout_expired with recent logging changes. kernel/nvgpu/drivers/gpu/nvgpu/common/falcon/falcon.c:101 Checker: MISRA C-2012 Rule 5.3 (Required) kernel/nvgpu/drivers/gpu/nvgpu/common/falcon/falcon.c:101: 1. misra_c_2012_rule_5_3_violation: Declaration with identifier "ret" hides another declaration. kernel/nvgpu/drivers/gpu/nvgpu/common/falcon/falcon.c:101: 2. hidden_declaration: This declaration of "ret" is hidden. JIRA NVGPU-4283 Change-Id: I8932cf84efaf0652f10e66ab174e24548a91c143 Signed-off-by: Sagar Kamble Reviewed-on: https://git-master.nvidia.com/r/2222414 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Vijayakumar Subbu Reviewed-by: mobile promotions Tested-by: mobile promotions --- .../gpu/nvgpu/include/nvgpu/posix/timers.h | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/nvgpu/include/nvgpu/posix/timers.h b/drivers/gpu/nvgpu/include/nvgpu/posix/timers.h index 8eeadf21d..6ffadbb9a 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/posix/timers.h +++ b/drivers/gpu/nvgpu/include/nvgpu/posix/timers.h @@ -47,15 +47,15 @@ #define nvgpu_timeout_expired_msg_cpu(timeout, caller, fmt, arg...) \ ({ \ struct nvgpu_timeout *t_ptr = (timeout); \ - int ret = 0; \ + int ret_cpu = 0; \ if (nvgpu_current_time_ns() > t_ptr->time) { \ if ((t_ptr->flags & NVGPU_TIMER_SILENT_TIMEOUT) == 0U) { \ nvgpu_err(t_ptr->g, "Timeout detected @ %p" fmt, \ caller, ##arg); \ } \ - ret = -ETIMEDOUT; \ + ret_cpu = -ETIMEDOUT; \ } \ - (int)ret; \ + (int)ret_cpu; \ }) /** @@ -76,17 +76,17 @@ #define nvgpu_timeout_expired_msg_retry(timeout, caller, fmt, arg...) \ ({ \ struct nvgpu_timeout *t_ptr = (timeout); \ - int ret = 0; \ + int ret_retry = 0; \ if (t_ptr->retries.attempted >= t_ptr->retries.max_attempts) { \ if ((t_ptr->flags & NVGPU_TIMER_SILENT_TIMEOUT) == 0U) { \ nvgpu_err(t_ptr->g, "No more retries @ %p" fmt, \ caller, ##arg); \ } \ - ret = -ETIMEDOUT; \ + ret_retry = -ETIMEDOUT; \ } else { \ t_ptr->retries.attempted++; \ } \ - (int)ret; \ + (int)ret_retry; \ }) /** @@ -105,15 +105,15 @@ */ #define nvgpu_timeout_expired_msg_impl(timeout, caller, fmt, arg...) \ ({ \ - int ret = 0; \ + int ret_timeout = 0; \ if (((timeout)->flags & NVGPU_TIMER_RETRY_TIMER) != 0U) { \ - ret = nvgpu_timeout_expired_msg_retry((timeout), caller,\ - fmt, ##arg); \ + ret_timeout = nvgpu_timeout_expired_msg_retry((timeout),\ + caller, fmt, ##arg); \ } else { \ - ret = nvgpu_timeout_expired_msg_cpu((timeout), caller, \ - fmt, ##arg); \ + ret_timeout = nvgpu_timeout_expired_msg_cpu((timeout), \ + caller, fmt, ##arg); \ } \ - (int)ret; \ + (int)ret_timeout; \ }) #endif