From c7a3b6db10900e0aabc29ca7307908875d685036 Mon Sep 17 00:00:00 2001 From: smadhavan Date: Thu, 6 Sep 2018 14:08:00 +0530 Subject: gpu: nvgpu: Fix MISRA 15.6 violations MISRA Rule-15.6 requires that all if-else blocks be enclosed in braces, including single statement blocks. Fix errors due to single statement if blocks without braces by introducing the braces. JIRA NVGPU-671 Change-Id: I8046a09fa7ffc74c3d737ba57132a0a9ae2ff195 Signed-off-by: smadhavan Reviewed-on: https://git-master.nvidia.com/r/1797699 Reviewed-by: svc-misra-checker Reviewed-by: Nitin Kumbhar GVS: Gerrit_Virtual_Submit Reviewed-by: Konsta Holtta Reviewed-by: Vijayakumar Subbu Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/include/nvgpu/kref.h | 5 +++-- drivers/gpu/nvgpu/include/nvgpu/ptimer.h | 5 +++-- drivers/gpu/nvgpu/include/nvgpu/xve.h | 3 ++- 3 files changed, 8 insertions(+), 5 deletions(-) (limited to 'drivers/gpu/nvgpu/include') diff --git a/drivers/gpu/nvgpu/include/nvgpu/kref.h b/drivers/gpu/nvgpu/include/nvgpu/kref.h index 72b21ec4..2cbc07bc 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/kref.h +++ b/drivers/gpu/nvgpu/include/nvgpu/kref.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2017-2018, 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"), @@ -66,8 +66,9 @@ static inline int nvgpu_ref_put(struct nvgpu_ref *ref, void (*release)(struct nvgpu_ref *r)) { if (nvgpu_atomic_sub_and_test(1, &ref->refcount)) { - if (release != NULL) + if (release != NULL) { release(ref); + } return 1; } return 0; diff --git a/drivers/gpu/nvgpu/include/nvgpu/ptimer.h b/drivers/gpu/nvgpu/include/nvgpu/ptimer.h index 598e064f..3369eb20 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/ptimer.h +++ b/drivers/gpu/nvgpu/include/nvgpu/ptimer.h @@ -42,10 +42,11 @@ static inline u32 ptimer_scalingfactor10x(u32 ptimer_src_freq) static inline u32 scale_ptimer(u32 timeout , u32 scale10x) { - if (((timeout*10) % scale10x) >= (scale10x/2)) + if (((timeout*10) % scale10x) >= (scale10x/2)) { return ((timeout * 10) / scale10x) + 1; - else + } else { return (timeout * 10) / scale10x; + } } int nvgpu_get_timestamps_zipper(struct gk20a *g, diff --git a/drivers/gpu/nvgpu/include/nvgpu/xve.h b/drivers/gpu/nvgpu/include/nvgpu/xve.h index acaf441c..2d0d6982 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/xve.h +++ b/drivers/gpu/nvgpu/include/nvgpu/xve.h @@ -55,8 +55,9 @@ static inline const char *xve_speed_to_str(u32 speed) { if (!speed || !is_power_of_2(speed) || - !(speed & GPU_XVE_SPEED_MASK)) + !(speed & GPU_XVE_SPEED_MASK)) { return "Unknown ???"; + } return speed & GPU_XVE_SPEED_2P5 ? "Gen1" : speed & GPU_XVE_SPEED_5P0 ? "Gen2" : -- cgit v1.2.2