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>
This commit is contained in:
Scott Long
2018-07-02 17:57:21 -07:00
committed by mobile promotions
parent d995644382
commit d32692ae24
7 changed files with 50 additions and 51 deletions

View File

@@ -49,4 +49,10 @@ static inline u32 get_field(u32 reg, u32 mask)
{
return (reg & mask);
}
/*
* MISRA Rule 11.6 compliant IP address generator.
*/
#define _NVGPU_GET_IP_ ({ __label__ __here; __here: &&__here; })
#endif /* NVGPU_UTILS_H */