From d0f3529d10a23e5780a9556ba3b9a73181b4b115 Mon Sep 17 00:00:00 2001 From: Scott Long Date: Mon, 13 Jan 2020 13:21:37 -0800 Subject: [PATCH] gpu: nvgpu: posix misra 12.1 fix MISRA Advisory Rule states that the precedence of operators within expressions should be made explicit. This change removes the Advisory Rule 12.1 violations from the implementation of the is_power_of_2() macro. Jira NVGPU-3178 Change-Id: I75117e9ab6e47beddebeebaa23c6408b6ceb88ad Signed-off-by: Scott Long Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2278574 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Adeel Raza Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/include/nvgpu/posix/log2.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/nvgpu/include/nvgpu/posix/log2.h b/drivers/gpu/nvgpu/include/nvgpu/posix/log2.h index 983c70316..3ad59fe7b 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/posix/log2.h +++ b/drivers/gpu/nvgpu/include/nvgpu/posix/log2.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2018-2020, NVIDIA CORPORATION. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -59,9 +59,9 @@ ret; \ }) -#define is_power_of_2(x) \ - (bool)({ \ - typeof(x) __x__ = (x); \ - (__x__ != 0U && ((__x__ & (__x__ - 1U)) == 0U));\ +#define is_power_of_2(x) \ + (bool)({ \ + typeof(x) __x__ = (x); \ + ((__x__ != 0U) && ((__x__ & (__x__ - 1U)) == 0U)); \ }) #endif /* NVGPU_POSIX_LOG2_H */