summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/fence_gk20a.c
diff options
context:
space:
mode:
authorScott Long <scottl@nvidia.com>2018-07-09 13:32:25 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2018-07-30 22:55:13 -0400
commitd9956443820d64ac7f6e2fe7a9d10c1ac4956938 (patch)
treeb5fc701d815ccf9cebc2a093e16feeea48bbc4c9 /drivers/gpu/nvgpu/gk20a/fence_gk20a.c
parent82a90170d3ecbed5106409546f33afa5eaea3ddf (diff)
gpu: nvgpu: fix MISRA Rule 11.6 issue with fence pool mgmt
MISRA Rule 11.6 prohibits the casting of an integer value to a void *. The nvgpu allocator used for the fence pool stores the base address of the associated memory as a u64 and returns it via nvgpu_alloc_base(). In gk20a_free_fence_pool() this u64 value was cast to a void * before being passed to nvgpu_vfree() (leading to the violation). This change modifies gk20a_free_fence_pool() to cast the base address back to the original struct gk20a_fence * to eliminate the violation. JIRA NVGPU-895: MISRA Rule 11.6 violations Change-Id: If89cf2c1bc8ea4b0b59da4cf8b1c167738f6badc Signed-off-by: Scott Long <scottl@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1774530 Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Adeel Raza <araza@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/fence_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/fence_gk20a.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/fence_gk20a.c b/drivers/gpu/nvgpu/gk20a/fence_gk20a.c
index 142663dd..8f585afd 100644
--- a/drivers/gpu/nvgpu/gk20a/fence_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/fence_gk20a.c
@@ -139,11 +139,11 @@ fail:
139void gk20a_free_fence_pool(struct channel_gk20a *c) 139void gk20a_free_fence_pool(struct channel_gk20a *c)
140{ 140{
141 if (nvgpu_alloc_initialized(&c->fence_allocator)) { 141 if (nvgpu_alloc_initialized(&c->fence_allocator)) {
142 void *base = (void *)(uintptr_t) 142 struct gk20a_fence *fence_pool;
143 fence_pool = (struct gk20a_fence *)(uintptr_t)
143 nvgpu_alloc_base(&c->fence_allocator); 144 nvgpu_alloc_base(&c->fence_allocator);
144
145 nvgpu_alloc_destroy(&c->fence_allocator); 145 nvgpu_alloc_destroy(&c->fence_allocator);
146 nvgpu_vfree(c->g, base); 146 nvgpu_vfree(c->g, fence_pool);
147 } 147 }
148} 148}
149 149