From c1173d11df7ab3a4c3057d34f388612d8f8442a3 Mon Sep 17 00:00:00 2001 From: Seeta Rama Raju Date: Tue, 22 Sep 2020 10:02:30 +0530 Subject: [PATCH] gpu: nvgpu: Fix for MISRA 10.1 violation - The expression "0" of non-boolean essential type is being interpreted as a boolean value for the operator "!" JIRA NVGPU-6058 Change-Id: Iff9f81dcca5b4aa6636b688888010d5c964b93c1 Signed-off-by: Seeta Rama Raju Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2417642 (cherry picked from commit dcc8cdbc09e3db3500be7a350295bee58808a62a) Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2434188 Reviewed-by: automaticguardword Reviewed-by: Alex Waterman Reviewed-by: mobile promotions GVS: Gerrit_Virtual_Submit Tested-by: mobile promotions --- drivers/gpu/nvgpu/include/nvgpu/bug.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/nvgpu/include/nvgpu/bug.h b/drivers/gpu/nvgpu/include/nvgpu/bug.h index 6e16dedb3..f9ff2509b 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/bug.h +++ b/drivers/gpu/nvgpu/include/nvgpu/bug.h @@ -53,7 +53,7 @@ ({ \ NVGPU_COV_WHITELIST_BLOCK_BEGIN(false_positive, 1, NVGPU_MISRA(Rule, 14_4), "Bug 2277532") \ NVGPU_COV_WHITELIST_BLOCK_BEGIN(false_positive, 1, NVGPU_MISRA(Rule, 15_6), "Bug 2277532") \ - BUG_ON(!(cond)); \ + BUG_ON((cond) == ((bool)(0 != 0))); \ NVGPU_COV_WHITELIST_BLOCK_END(NVGPU_MISRA(Rule, 14_4)) \ NVGPU_COV_WHITELIST_BLOCK_END(NVGPU_MISRA(Rule, 15_6)) \ }) @@ -66,7 +66,7 @@ */ #define nvgpu_do_assert() \ NVGPU_COV_WHITELIST(false_positive, NVGPU_MISRA(Rule, 10_3), "Bug 2623654") \ - nvgpu_assert(false) + nvgpu_assert((bool)(0 != 0)) /* * Define compile-time assert check.