gpu: nvgpu: fix MISRA 5.7 and 10.4 violations

- Rule 5.7 doesn't allow an identifier to be reused.
  This change renames variable "ops" to resolve this violation.

- Rule 10.4 says both operands of operators in which arithmetic
  operations will be do shall be of same type.

JIRA NVGPU-6056

Change-Id: Ic88f398c49d122cee206efcf88afd1edf951b042
Signed-off-by: srajum <srajum@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2561772
(cherry picked from commit c129465413db2c28bfcb0a039962cb65e2fca1ea)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2677518
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Dinesh T <dt@nvidia.com>
Reviewed-by: Ankur Kishore <ankkishore@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
srajum
2021-07-20 17:47:56 +05:30
committed by mobile promotions
parent c0f4723339
commit 07583dffed
3 changed files with 5 additions and 5 deletions

View File

@@ -61,7 +61,7 @@ static u32 nvgpu_pd_cache_nr(u32 bytes)
static u32 nvgpu_pd_cache_get_nr_entries(struct nvgpu_pd_mem_entry *pentry)
{
BUG_ON(pentry->pd_size == 0);
BUG_ON(pentry->pd_size == 0U);
return (nvgpu_safe_cast_u64_to_u32(NVGPU_PD_CACHE_SIZE)) /
pentry->pd_size;

View File

@@ -275,7 +275,7 @@ void nvgpu_worker_init_name(struct nvgpu_worker *worker,
}
int nvgpu_worker_init(struct gk20a *g, struct nvgpu_worker *worker,
const struct nvgpu_worker_ops *ops)
const struct nvgpu_worker_ops *worker_ops)
{
int err;
@@ -286,7 +286,7 @@ int nvgpu_worker_init(struct gk20a *g, struct nvgpu_worker *worker,
nvgpu_spinlock_init(&worker->items_lock);
nvgpu_mutex_init(&worker->start_lock);
worker->ops = ops;
worker->ops = worker_ops;
err = nvgpu_worker_start(worker);
if (err != 0) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2021, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2016-2022, NVIDIA CORPORATION. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -309,7 +309,7 @@ void nvgpu_worker_init_name(struct nvgpu_worker *worker,
* start routine provided for thread creation.
*/
int nvgpu_worker_init(struct gk20a *g, struct nvgpu_worker *worker,
const struct nvgpu_worker_ops *ops);
const struct nvgpu_worker_ops *worker_ops);
/**
* @brief Stop the background thread associated with the worker.