mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-23 18:16:01 +03:00
MISRA rule 13.5 doesn't allow right-hand operand of logical && or || operator to have persistent side effects. The reason is right-hand operand is executed or checked depending on the left-hand operand value. That means side effects in the right-hand operand may or may not occur, contrary to programmer's expectation. Hence, this rule is implemented to avoid unexpected behavior. This patch divides if condition with logical && operator to nested if conditions to resolve this violation. Jira NVGPU-3277 Change-Id: I9f4387d71427821278db6bbda2eb53bd4d8ea543 Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/2119684 Reviewed-by: Philip Elcan <pelcan@nvidia.com> Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Vinod Gopalakrishnakurup <vinodg@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>