aboutsummaryrefslogtreecommitdiffstats
path: root/include/lib/object_pool.h
diff options
context:
space:
mode:
authorLouis Mayencourt <louis.mayencourt@arm.com>2020-02-24 14:37:25 +0000
committerLouis Mayencourt <louis.mayencourt@arm.com>2020-02-27 16:14:07 +0000
commit845db72261658ec8f1f3c10b0f7408b19fb91a7e (patch)
treeddb9ebcde89c08f351d712727a807380c4538044 /include/lib/object_pool.h
parent2f39c55c085ae92b6eead06172096410e5aab81c (diff)
downloadplatform_external_arm-trusted-firmware-845db72261658ec8f1f3c10b0f7408b19fb91a7e.tar.gz
platform_external_arm-trusted-firmware-845db72261658ec8f1f3c10b0f7408b19fb91a7e.tar.bz2
platform_external_arm-trusted-firmware-845db72261658ec8f1f3c10b0f7408b19fb91a7e.zip
fconf: Fix misra issues
MISRA C-2012 Rule 20.7: Macro parameter expands into an expression without being wrapped by parentheses. MISRA C-2012 Rule 12.1: Missing explicit parentheses on sub-expression. MISRA C-2012 Rule 18.4: Essential type of the left hand operand is not the same as that of the right operand. Include does not provide any needed symbols. Change-Id: Ie1c6451cfbc8f519146c28b2cf15c50b1f36adc8 Signed-off-by: Louis Mayencourt <louis.mayencourt@arm.com>
Diffstat (limited to 'include/lib/object_pool.h')
-rw-r--r--include/lib/object_pool.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/include/lib/object_pool.h b/include/lib/object_pool.h
index 0f85331a8..66e8c4780 100644
--- a/include/lib/object_pool.h
+++ b/include/lib/object_pool.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2018-2020, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -56,13 +56,13 @@ struct object_pool {
*/
static inline void *pool_alloc_n(struct object_pool *pool, size_t count)
{
- if (pool->used + count > pool->capacity) {
+ if ((pool->used + count) > pool->capacity) {
ERROR("Cannot allocate %zu objects out of pool (%zu objects left).\n",
count, pool->capacity - pool->used);
panic();
}
- void *obj = (char *)(pool->objects) + pool->obj_size * pool->used;
+ void *obj = (char *)(pool->objects) + (pool->obj_size * pool->used);
pool->used += count;
return obj;
}