diff options
author | Scott Long <scottl@nvidia.com> | 2018-07-02 20:57:21 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2018-07-30 22:55:16 -0400 |
commit | d32692ae2427693daf85b3c7b4e24cd36471dec6 (patch) | |
tree | b1bb9c697c636847e12afd956b666241176cc1d4 /drivers/gpu/nvgpu/os/linux | |
parent | d9956443820d64ac7f6e2fe7a9d10c1ac4956938 (diff) |
gpu: nvgpu: fix MISRA Rule 11.6 issue with _THIS_IP_
The use of the _THIS_IP_ macro in nvgpu introduces two separate
MISRA Rule 11.6 violations.
The first is when when the label address (which gcc generates as
a void *) is cast to an unsigned long and the second is when that
unsigned long is cast back to a void * in the timer and kmem code
that track the value.
Skipping the intermediate use of unsigned long eliminates these
violations. To do this, references to _THIS_IP_ are replaced
with a new (compliant) _NVGPU_GET_IP_ macro.
JIRA NVGPU-895 : MISRA Rule 11.6 violations
Change-Id: I5ea999d8e2b467257fa190b485fa971adcbd0a2b
Signed-off-by: Scott Long <scottl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1774531
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/os/linux')
-rw-r--r-- | drivers/gpu/nvgpu/os/linux/kmem.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/gpu/nvgpu/os/linux/kmem.c b/drivers/gpu/nvgpu/os/linux/kmem.c index 10946a08..86572bcc 100644 --- a/drivers/gpu/nvgpu/os/linux/kmem.c +++ b/drivers/gpu/nvgpu/os/linux/kmem.c | |||
@@ -69,7 +69,7 @@ void nvgpu_big_free(struct gk20a *g, void *p) | |||
69 | nvgpu_kfree(g, p); | 69 | nvgpu_kfree(g, p); |
70 | } | 70 | } |
71 | 71 | ||
72 | void *__nvgpu_kmalloc(struct gk20a *g, size_t size, unsigned long ip) | 72 | void *__nvgpu_kmalloc(struct gk20a *g, size_t size, void *ip) |
73 | { | 73 | { |
74 | void *alloc; | 74 | void *alloc; |
75 | 75 | ||
@@ -85,7 +85,7 @@ void *__nvgpu_kmalloc(struct gk20a *g, size_t size, unsigned long ip) | |||
85 | return alloc; | 85 | return alloc; |
86 | } | 86 | } |
87 | 87 | ||
88 | void *__nvgpu_kzalloc(struct gk20a *g, size_t size, unsigned long ip) | 88 | void *__nvgpu_kzalloc(struct gk20a *g, size_t size, void *ip) |
89 | { | 89 | { |
90 | void *alloc; | 90 | void *alloc; |
91 | 91 | ||
@@ -101,7 +101,7 @@ void *__nvgpu_kzalloc(struct gk20a *g, size_t size, unsigned long ip) | |||
101 | return alloc; | 101 | return alloc; |
102 | } | 102 | } |
103 | 103 | ||
104 | void *__nvgpu_kcalloc(struct gk20a *g, size_t n, size_t size, unsigned long ip) | 104 | void *__nvgpu_kcalloc(struct gk20a *g, size_t n, size_t size, void *ip) |
105 | { | 105 | { |
106 | void *alloc; | 106 | void *alloc; |
107 | 107 | ||
@@ -117,7 +117,7 @@ void *__nvgpu_kcalloc(struct gk20a *g, size_t n, size_t size, unsigned long ip) | |||
117 | return alloc; | 117 | return alloc; |
118 | } | 118 | } |
119 | 119 | ||
120 | void *__nvgpu_vmalloc(struct gk20a *g, unsigned long size, unsigned long ip) | 120 | void *__nvgpu_vmalloc(struct gk20a *g, unsigned long size, void *ip) |
121 | { | 121 | { |
122 | void *alloc; | 122 | void *alloc; |
123 | 123 | ||
@@ -132,7 +132,7 @@ void *__nvgpu_vmalloc(struct gk20a *g, unsigned long size, unsigned long ip) | |||
132 | return alloc; | 132 | return alloc; |
133 | } | 133 | } |
134 | 134 | ||
135 | void *__nvgpu_vzalloc(struct gk20a *g, unsigned long size, unsigned long ip) | 135 | void *__nvgpu_vzalloc(struct gk20a *g, unsigned long size, void *ip) |
136 | { | 136 | { |
137 | void *alloc; | 137 | void *alloc; |
138 | 138 | ||
@@ -228,7 +228,7 @@ static struct nvgpu_mem_alloc *nvgpu_rem_alloc( | |||
228 | 228 | ||
229 | static int __nvgpu_save_kmem_alloc(struct nvgpu_mem_alloc_tracker *tracker, | 229 | static int __nvgpu_save_kmem_alloc(struct nvgpu_mem_alloc_tracker *tracker, |
230 | unsigned long size, unsigned long real_size, | 230 | unsigned long size, unsigned long real_size, |
231 | u64 addr, unsigned long ip) | 231 | u64 addr, void *ip) |
232 | { | 232 | { |
233 | int ret; | 233 | int ret; |
234 | struct nvgpu_mem_alloc *alloc; | 234 | struct nvgpu_mem_alloc *alloc; |
@@ -244,7 +244,7 @@ static int __nvgpu_save_kmem_alloc(struct nvgpu_mem_alloc_tracker *tracker, | |||
244 | alloc->size = size; | 244 | alloc->size = size; |
245 | alloc->real_size = real_size; | 245 | alloc->real_size = real_size; |
246 | alloc->addr = addr; | 246 | alloc->addr = addr; |
247 | alloc->ip = (void *)(uintptr_t)ip; | 247 | alloc->ip = ip; |
248 | 248 | ||
249 | #ifdef __NVGPU_SAVE_KALLOC_STACK_TRACES | 249 | #ifdef __NVGPU_SAVE_KALLOC_STACK_TRACES |
250 | stack_trace.max_entries = MAX_STACK_TRACE; | 250 | stack_trace.max_entries = MAX_STACK_TRACE; |
@@ -322,7 +322,7 @@ static void __nvgpu_check_kalloc_size(size_t size) | |||
322 | } | 322 | } |
323 | 323 | ||
324 | void *__nvgpu_track_vmalloc(struct gk20a *g, unsigned long size, | 324 | void *__nvgpu_track_vmalloc(struct gk20a *g, unsigned long size, |
325 | unsigned long ip) | 325 | void *ip) |
326 | { | 326 | { |
327 | void *alloc = vmalloc(size); | 327 | void *alloc = vmalloc(size); |
328 | 328 | ||
@@ -342,7 +342,7 @@ void *__nvgpu_track_vmalloc(struct gk20a *g, unsigned long size, | |||
342 | } | 342 | } |
343 | 343 | ||
344 | void *__nvgpu_track_vzalloc(struct gk20a *g, unsigned long size, | 344 | void *__nvgpu_track_vzalloc(struct gk20a *g, unsigned long size, |
345 | unsigned long ip) | 345 | void *ip) |
346 | { | 346 | { |
347 | void *alloc = vzalloc(size); | 347 | void *alloc = vzalloc(size); |
348 | 348 | ||
@@ -361,7 +361,7 @@ void *__nvgpu_track_vzalloc(struct gk20a *g, unsigned long size, | |||
361 | return alloc; | 361 | return alloc; |
362 | } | 362 | } |
363 | 363 | ||
364 | void *__nvgpu_track_kmalloc(struct gk20a *g, size_t size, unsigned long ip) | 364 | void *__nvgpu_track_kmalloc(struct gk20a *g, size_t size, void *ip) |
365 | { | 365 | { |
366 | void *alloc = kmalloc(size, GFP_KERNEL); | 366 | void *alloc = kmalloc(size, GFP_KERNEL); |
367 | 367 | ||
@@ -376,7 +376,7 @@ void *__nvgpu_track_kmalloc(struct gk20a *g, size_t size, unsigned long ip) | |||
376 | return alloc; | 376 | return alloc; |
377 | } | 377 | } |
378 | 378 | ||
379 | void *__nvgpu_track_kzalloc(struct gk20a *g, size_t size, unsigned long ip) | 379 | void *__nvgpu_track_kzalloc(struct gk20a *g, size_t size, void *ip) |
380 | { | 380 | { |
381 | void *alloc = kzalloc(size, GFP_KERNEL); | 381 | void *alloc = kzalloc(size, GFP_KERNEL); |
382 | 382 | ||
@@ -392,7 +392,7 @@ void *__nvgpu_track_kzalloc(struct gk20a *g, size_t size, unsigned long ip) | |||
392 | } | 392 | } |
393 | 393 | ||
394 | void *__nvgpu_track_kcalloc(struct gk20a *g, size_t n, size_t size, | 394 | void *__nvgpu_track_kcalloc(struct gk20a *g, size_t n, size_t size, |
395 | unsigned long ip) | 395 | void *ip) |
396 | { | 396 | { |
397 | void *alloc = kcalloc(n, size, GFP_KERNEL); | 397 | void *alloc = kcalloc(n, size, GFP_KERNEL); |
398 | 398 | ||