mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 02:22:34 +03:00
gpu: nvgpu: Combine else paths in nvgpu_assert()
The else path in the nvgpu_assert() call definition handles the non-Linux kernel platforms. These platforms are generally safety conscious and as a result care about MISRA scans and unit testing. The static inline hides the BUG_ON() call from the unit test branch analyzer and the MISRA analyzer. Note: the MISRA issue still exists; however, it's just not seen when analyzing patches that only use the nvgpu_assert() call. This patch combines the __POSIX__ path with the general else path to ensure that all non-Linux platforms use the aforementioned static inline. JIRA NVGPU-1246 Change-Id: I3f267224acd0b27429302118872c40ca6d7b9137 Signed-off-by: Alex Waterman <alexw@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1977276 Reviewed-by: Adeel Raza <araza@nvidia.com> Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
a307b6eb77
commit
150905fff2
@@ -45,18 +45,21 @@
|
||||
*/
|
||||
#if defined(__KERNEL__)
|
||||
#define nvgpu_assert(cond) WARN_ON(!(cond))
|
||||
#elif defined(__NVGPU_POSIX__)
|
||||
#else
|
||||
/*
|
||||
* A static inline for POSIX so that we can hide the branch in BUG_ON() from the
|
||||
* branch analysis for users of this function. When this assert fails the
|
||||
* function will not return.
|
||||
* A static inline for POSIX/QNX/etc so that we can hide the branch in BUG_ON()
|
||||
* from the branch analyzer. This prevents unit testing branch analysis from
|
||||
* marking this as an untested branch everywhere the nvgpu_assert() macro is
|
||||
* used. Similarly for MISRA this hides the messy BUG_ON() macro from users of
|
||||
* this function. This means the MISRA scanner will only trigger 1 issue for
|
||||
* this instead of 1 for every place it's used.
|
||||
*
|
||||
* When this assert fails the function will not return.
|
||||
*/
|
||||
static inline void nvgpu_assert(bool cond)
|
||||
{
|
||||
BUG_ON(!cond);
|
||||
}
|
||||
#else
|
||||
#define nvgpu_assert(cond) BUG_ON(!(cond))
|
||||
#endif
|
||||
|
||||
#endif /* NVGPU_BUG_H */
|
||||
|
||||
Reference in New Issue
Block a user