summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/include
diff options
context:
space:
mode:
authorsmadhavan <smadhavan@nvidia.com>2018-09-06 04:38:00 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2018-09-12 08:36:04 -0400
commitc7a3b6db10900e0aabc29ca7307908875d685036 (patch)
tree1ee88207c5149344841b1423d0cb920498f844b0 /drivers/gpu/nvgpu/include
parentc615002d22b4675d08404eb7cc7087d4418eccdb (diff)
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 <smadhavan@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1797699 Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com> Reviewed-by: Nitin Kumbhar <nkumbhar@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Konsta Holtta <kholtta@nvidia.com> Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/include')
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/kref.h5
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/ptimer.h5
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/xve.h3
3 files changed, 8 insertions, 5 deletions
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 @@
1/* 1/*
2 * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a 4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"), 5 * copy of this software and associated documentation files (the "Software"),
@@ -66,8 +66,9 @@ static inline int nvgpu_ref_put(struct nvgpu_ref *ref,
66 void (*release)(struct nvgpu_ref *r)) 66 void (*release)(struct nvgpu_ref *r))
67{ 67{
68 if (nvgpu_atomic_sub_and_test(1, &ref->refcount)) { 68 if (nvgpu_atomic_sub_and_test(1, &ref->refcount)) {
69 if (release != NULL) 69 if (release != NULL) {
70 release(ref); 70 release(ref);
71 }
71 return 1; 72 return 1;
72 } 73 }
73 return 0; 74 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)
42 42
43static inline u32 scale_ptimer(u32 timeout , u32 scale10x) 43static inline u32 scale_ptimer(u32 timeout , u32 scale10x)
44{ 44{
45 if (((timeout*10) % scale10x) >= (scale10x/2)) 45 if (((timeout*10) % scale10x) >= (scale10x/2)) {
46 return ((timeout * 10) / scale10x) + 1; 46 return ((timeout * 10) / scale10x) + 1;
47 else 47 } else {
48 return (timeout * 10) / scale10x; 48 return (timeout * 10) / scale10x;
49 }
49} 50}
50 51
51int nvgpu_get_timestamps_zipper(struct gk20a *g, 52int 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 @@
55static inline const char *xve_speed_to_str(u32 speed) 55static inline const char *xve_speed_to_str(u32 speed)
56{ 56{
57 if (!speed || !is_power_of_2(speed) || 57 if (!speed || !is_power_of_2(speed) ||
58 !(speed & GPU_XVE_SPEED_MASK)) 58 !(speed & GPU_XVE_SPEED_MASK)) {
59 return "Unknown ???"; 59 return "Unknown ???";
60 }
60 61
61 return speed & GPU_XVE_SPEED_2P5 ? "Gen1" : 62 return speed & GPU_XVE_SPEED_2P5 ? "Gen1" :
62 speed & GPU_XVE_SPEED_5P0 ? "Gen2" : 63 speed & GPU_XVE_SPEED_5P0 ? "Gen2" :