From 70c20bb75be7815ebc67ac82d6999f46bc25ed6d Mon Sep 17 00:00:00 2001 From: Srirangan Date: Tue, 14 Aug 2018 10:57:15 +0530 Subject: gpu: nvgpu: common: mm: 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, introducing the braces. JIRA NVGPU-671 Change-Id: Ieeecf719dca9acc1a116d2893637bf770caf4f5b Signed-off-by: Srirangan Reviewed-on: https://git-master.nvidia.com/r/1794241 GVS: Gerrit_Virtual_Submit Reviewed-by: Adeel Raza Reviewed-by: Alex Waterman Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/mm/lockless_allocator.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'drivers/gpu/nvgpu/common/mm/lockless_allocator.c') diff --git a/drivers/gpu/nvgpu/common/mm/lockless_allocator.c b/drivers/gpu/nvgpu/common/mm/lockless_allocator.c index 4a3d6c9d..7a5f67e9 100644 --- a/drivers/gpu/nvgpu/common/mm/lockless_allocator.c +++ b/drivers/gpu/nvgpu/common/mm/lockless_allocator.c @@ -63,8 +63,9 @@ static u64 nvgpu_lockless_alloc(struct nvgpu_allocator *a, u64 len) int head, new_head, ret; u64 addr = 0; - if (len != pa->blk_size) + if (len != pa->blk_size) { return 0; + } head = NV_ACCESS_ONCE(pa->head); while (head >= 0) { @@ -80,10 +81,11 @@ static u64 nvgpu_lockless_alloc(struct nvgpu_allocator *a, u64 len) head = NV_ACCESS_ONCE(pa->head); } - if (addr) + if (addr) { alloc_dbg(a, "Alloc node # %d @ addr 0x%llx", head, addr); - else + } else { alloc_dbg(a, "Alloc failed!"); + } return addr; } @@ -167,24 +169,28 @@ int nvgpu_lockless_allocator_init(struct gk20a *g, struct nvgpu_allocator *__a, u64 count; struct nvgpu_lockless_allocator *a; - if (!blk_size) + if (!blk_size) { return -EINVAL; + } /* * Ensure we have space for at least one node & there's no overflow. * In order to control memory footprint, we require count < INT_MAX */ count = length / blk_size; - if (!base || !count || count > INT_MAX) + if (!base || !count || count > INT_MAX) { return -EINVAL; + } a = nvgpu_kzalloc(g, sizeof(struct nvgpu_lockless_allocator)); - if (!a) + if (!a) { return -ENOMEM; + } err = __nvgpu_alloc_common_init(__a, g, name, a, false, &pool_ops); - if (err) + if (err) { goto fail; + } a->next = nvgpu_vzalloc(g, sizeof(*a->next) * count); if (!a->next) { -- cgit v1.2.2