gpu: nvgpu: POSIX MISRA cleanups in bug.h

The POSIX code does not need to be MISRA complient but any macro
code in the POSIX stuff does get checked by nature of the scanner.
Thus we get a lot of false positives that are annoying.

This change fixes a couple of issues in the BUG() and WARN()
macros: '__' prefixes, missing '{}' in if-conditions, and using
a non-boolean in boolean context.

Change-Id: I064b90c2088ef4ea5093ed456241a98f166008ac
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1816681
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-by: Scott Long <scottl@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Alex Waterman
2018-09-07 14:07:40 -07:00
committed by Abdul Salam
parent 9b8185b261
commit 180e8be77c

View File

@@ -32,18 +32,19 @@
#define BUG() __bug("")
#define BUG_ON(cond) \
do { \
if (cond) \
if (cond) { \
BUG(); \
} \
} while (0)
#define WARN(cond, msg, arg...) __warn(cond, msg, ##arg)
#define WARN_ON(cond) __warn(cond, "")
#define WARN_ONCE(cond, msg, arg...) \
({static int __warned__ = 0; \
if (!__warned__) { \
({static bool warn_once_warned = false; \
if (!warn_once_warned) { \
WARN(cond, msg, ##arg); \
__warned__ = 1; \
warn_once_warned = true; \
} \
cond; })