From e6638354e928c2181ceee005012d7665a2e4ab9a Mon Sep 17 00:00:00 2001 From: Thomas Fleury Date: Fri, 3 May 2019 09:17:34 -0700 Subject: [PATCH] gpu: nvgpu: tsg MISRA fixes for Rule 14.2 nvgpu_list_for_each_entry_safe violates MISRA Rule 14.2, as it uses comma separator in the for clauses. Use a while loop instead in nvgpu_tsg_release, as we want to empty the list. Jira NVGPU-3380 Change-Id: I38211cc326e458d0912f374e3692328fb4e9b191 Signed-off-by: Thomas Fleury Reviewed-on: https://git-master.nvidia.com/r/2111383 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/fifo/tsg.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/nvgpu/common/fifo/tsg.c b/drivers/gpu/nvgpu/common/fifo/tsg.c index f16187f6f..546270660 100644 --- a/drivers/gpu/nvgpu/common/fifo/tsg.c +++ b/drivers/gpu/nvgpu/common/fifo/tsg.c @@ -731,7 +731,6 @@ void nvgpu_tsg_release(struct nvgpu_ref *ref) { struct tsg_gk20a *tsg = tsg_gk20a_from_ref(ref); struct gk20a *g = tsg->g; - struct gk20a_event_id_data *event_id_data, *event_id_data_temp; if (tsg->gr_ctx != NULL && nvgpu_mem_is_valid( nvgpu_gr_ctx_get_ctx_mem(tsg->gr_ctx)) && @@ -741,18 +740,15 @@ void nvgpu_tsg_release(struct nvgpu_ref *ref) /* unhook all events created on this TSG */ nvgpu_mutex_acquire(&tsg->event_id_list_lock); - nvgpu_list_for_each_entry_safe(event_id_data, event_id_data_temp, - &tsg->event_id_list, - gk20a_event_id_data, - event_id_node) { - nvgpu_list_del(&event_id_data->event_id_node); + while (nvgpu_list_empty(&tsg->event_id_list) == false) { + nvgpu_list_del(tsg->event_id_list.next); } nvgpu_mutex_release(&tsg->event_id_list_lock); nvgpu_tsg_release_common(g, tsg); release_used_tsg(&g->fifo, tsg); - nvgpu_log(g, gpu_dbg_fn, "tsg released %d\n", tsg->tsgid); + nvgpu_log(g, gpu_dbg_fn, "tsg released %d", tsg->tsgid); } struct tsg_gk20a *tsg_gk20a_from_ch(struct channel_gk20a *ch)