summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/fifo/submit.c
diff options
context:
space:
mode:
authorSai Nikhil <snikhil@nvidia.com>2018-08-22 01:12:37 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2018-08-22 20:30:19 -0400
commitd28a401e6d872f7ea6abb0c5cfc8f63e0235fe21 (patch)
tree66b5c4ad42135dbd9f5535fa3c86f8ecdd1a067c /drivers/gpu/nvgpu/common/fifo/submit.c
parent650171566bff59e9eb372f213fdce4dfbb6da5bd (diff)
gpu: nvgpu: common: fix MISRA 10.4 violations
MISRA Rule 10.4 only allows the usage of arithmetic operations on operands of the same essential type category. Adding "U" at the end of the integer literals to have same type of operands when an arithmetic operation is performed. This fix violations where an arithmetic operation is performed on signed and unsigned int types. Jira NVGPU-992 Change-Id: Iab512139a025e035ec82a9dd74245bcf1f3869fb Signed-off-by: Sai Nikhil <snikhil@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1789425 Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Adeel Raza <araza@nvidia.com> Reviewed-by: Alex Waterman <alexw@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common/fifo/submit.c')
-rw-r--r--drivers/gpu/nvgpu/common/fifo/submit.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/gpu/nvgpu/common/fifo/submit.c b/drivers/gpu/nvgpu/common/fifo/submit.c
index d034f2d3..7f2f677d 100644
--- a/drivers/gpu/nvgpu/common/fifo/submit.c
+++ b/drivers/gpu/nvgpu/common/fifo/submit.c
@@ -179,7 +179,7 @@ static void nvgpu_submit_append_priv_cmdbuf(struct channel_gk20a *c,
179 trace_gk20a_push_cmdbuf(g->name, 0, cmd->size, 0, 179 trace_gk20a_push_cmdbuf(g->name, 0, cmd->size, 0,
180 (u32 *)cmd->mem->cpu_va + cmd->off); 180 (u32 *)cmd->mem->cpu_va + cmd->off);
181 181
182 c->gpfifo.put = (c->gpfifo.put + 1) & (c->gpfifo.entry_num - 1); 182 c->gpfifo.put = (c->gpfifo.put + 1U) & (c->gpfifo.entry_num - 1U);
183} 183}
184 184
185static int nvgpu_submit_append_gpfifo_user_direct(struct channel_gk20a *c, 185static int nvgpu_submit_append_gpfifo_user_direct(struct channel_gk20a *c,
@@ -286,7 +286,7 @@ static int nvgpu_submit_append_gpfifo(struct channel_gk20a *c,
286 trace_write_pushbuffers(c, num_entries); 286 trace_write_pushbuffers(c, num_entries);
287 287
288 c->gpfifo.put = (c->gpfifo.put + num_entries) & 288 c->gpfifo.put = (c->gpfifo.put + num_entries) &
289 (c->gpfifo.entry_num - 1); 289 (c->gpfifo.entry_num - 1U);
290 290
291 return 0; 291 return 0;
292} 292}
@@ -307,7 +307,7 @@ static int nvgpu_submit_channel_gpfifo(struct channel_gk20a *c,
307 struct channel_gk20a_job *job = NULL; 307 struct channel_gk20a_job *job = NULL;
308 /* we might need two extra gpfifo entries - one for pre fence 308 /* we might need two extra gpfifo entries - one for pre fence
309 * and one for post fence. */ 309 * and one for post fence. */
310 const int extra_entries = 2; 310 const u32 extra_entries = 2U;
311 bool skip_buffer_refcounting = (flags & 311 bool skip_buffer_refcounting = (flags &
312 NVGPU_SUBMIT_FLAGS_SKIP_BUFFER_REFCOUNTING); 312 NVGPU_SUBMIT_FLAGS_SKIP_BUFFER_REFCOUNTING);
313 int err = 0; 313 int err = 0;
@@ -330,7 +330,7 @@ static int nvgpu_submit_channel_gpfifo(struct channel_gk20a *c,
330 * Kernel can insert gpfifo entries before and after user gpfifos. 330 * Kernel can insert gpfifo entries before and after user gpfifos.
331 * So, add extra_entries in user request. Also, HW with fifo size N 331 * So, add extra_entries in user request. Also, HW with fifo size N
332 * can accept only N-1 entreis and so the below condition */ 332 * can accept only N-1 entreis and so the below condition */
333 if (c->gpfifo.entry_num - 1 < num_entries + extra_entries) { 333 if (c->gpfifo.entry_num - 1U < num_entries + extra_entries) {
334 nvgpu_err(g, "not enough gpfifo space allocated"); 334 nvgpu_err(g, "not enough gpfifo space allocated");
335 return -ENOMEM; 335 return -ENOMEM;
336 } 336 }