mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-23 18:16:01 +03:00
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:
committed by
Abdul Salam
parent
9b8185b261
commit
180e8be77c
@@ -32,18 +32,19 @@
|
|||||||
#define BUG() __bug("")
|
#define BUG() __bug("")
|
||||||
#define BUG_ON(cond) \
|
#define BUG_ON(cond) \
|
||||||
do { \
|
do { \
|
||||||
if (cond) \
|
if (cond) { \
|
||||||
BUG(); \
|
BUG(); \
|
||||||
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define WARN(cond, msg, arg...) __warn(cond, msg, ##arg)
|
#define WARN(cond, msg, arg...) __warn(cond, msg, ##arg)
|
||||||
#define WARN_ON(cond) __warn(cond, "")
|
#define WARN_ON(cond) __warn(cond, "")
|
||||||
|
|
||||||
#define WARN_ONCE(cond, msg, arg...) \
|
#define WARN_ONCE(cond, msg, arg...) \
|
||||||
({static int __warned__ = 0; \
|
({static bool warn_once_warned = false; \
|
||||||
if (!__warned__) { \
|
if (!warn_once_warned) { \
|
||||||
WARN(cond, msg, ##arg); \
|
WARN(cond, msg, ##arg); \
|
||||||
__warned__ = 1; \
|
warn_once_warned = true; \
|
||||||
} \
|
} \
|
||||||
cond; })
|
cond; })
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user