From 71ec37ac4651d3cc48a9e6bd771bec2fb13394bf Mon Sep 17 00:00:00 2001 From: Seshendra Gadagottu Date: Wed, 15 May 2019 14:36:32 -0700 Subject: [PATCH] gpu: nvgpu: Fix MISRA 13.5 in hal ltc driver Fixed 13.5 misra violation by moving nvgpu_timeout_expired_msg_impl outside of while and added error value check. JIRA NVGPU-3422 Change-Id: I49df330d005efd64be3b4914c0338dd41bfb5b70 Signed-off-by: Seshendra Gadagottu Reviewed-on: https://git-master.nvidia.com/r/2119971 GVS: Gerrit_Virtual_Submit Reviewed-by: Vinod Gopalakrishnakurup Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/hal/ltc/ltc_gm20b.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/nvgpu/hal/ltc/ltc_gm20b.c b/drivers/gpu/nvgpu/hal/ltc/ltc_gm20b.c index 357cf3378..8c7cc40d3 100644 --- a/drivers/gpu/nvgpu/hal/ltc/ltc_gm20b.c +++ b/drivers/gpu/nvgpu/hal/ltc/ltc_gm20b.c @@ -121,9 +121,11 @@ void gm20b_flush_ltc(struct gk20a *g) op_pending = gk20a_readl(g, cmgmt1); is_clean_pending_set = (op_pending & ltc_ltc0_ltss_tstg_cmgmt1_clean_pending_f()) != 0U; - } while (is_clean_pending_set && - (nvgpu_timeout_expired_msg(&timeout, - "L2 flush timeout!") == 0)); + if (nvgpu_timeout_expired_msg(&timeout, + "L2 flush timeout!") != 0) { + err = -ETIMEDOUT; + } + } while (is_clean_pending_set && (err == 0)); } /* And invalidate. */ @@ -151,9 +153,11 @@ void gm20b_flush_ltc(struct gk20a *g) op_pending = gk20a_readl(g, cmgmt0); is_invalidate_pending_set = (op_pending & ltc_ltc0_ltss_tstg_cmgmt0_invalidate_pending_f()) != 0U; - } while (is_invalidate_pending_set && - (nvgpu_timeout_expired_msg(&timeout, - "L2 flush timeout!") == 0)); + if (nvgpu_timeout_expired_msg(&timeout, + "L2 flush timeout!") != 0) { + err = -ETIMEDOUT; + } + } while (is_invalidate_pending_set && (err == 0)); } }