From 07583dffed105c89a4292dd2cfe05d2189be961a Mon Sep 17 00:00:00 2001 From: srajum Date: Tue, 20 Jul 2021 17:47:56 +0530 Subject: [PATCH] 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 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 Reviewed-by: svc-mobile-misra Reviewed-by: svc-mobile-cert Reviewed-by: Dinesh T Reviewed-by: Ankur Kishore GVS: Gerrit_Virtual_Submit --- drivers/gpu/nvgpu/common/mm/gmmu/pd_cache.c | 2 +- drivers/gpu/nvgpu/common/utils/worker.c | 4 ++-- drivers/gpu/nvgpu/include/nvgpu/worker.h | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/nvgpu/common/mm/gmmu/pd_cache.c b/drivers/gpu/nvgpu/common/mm/gmmu/pd_cache.c index 8815b9471..df3511527 100644 --- a/drivers/gpu/nvgpu/common/mm/gmmu/pd_cache.c +++ b/drivers/gpu/nvgpu/common/mm/gmmu/pd_cache.c @@ -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; diff --git a/drivers/gpu/nvgpu/common/utils/worker.c b/drivers/gpu/nvgpu/common/utils/worker.c index fbdff554f..e5319cbb8 100644 --- a/drivers/gpu/nvgpu/common/utils/worker.c +++ b/drivers/gpu/nvgpu/common/utils/worker.c @@ -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) { diff --git a/drivers/gpu/nvgpu/include/nvgpu/worker.h b/drivers/gpu/nvgpu/include/nvgpu/worker.h index 2966282ce..41ad70d56 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/worker.h +++ b/drivers/gpu/nvgpu/include/nvgpu/worker.h @@ -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.