fix(rmm): fix MISRA C:2012 Rule 10.4
Signed-off-by: AlexeiFedorov <Alexei.Fedorov@arm.com>
Change-Id: I03630ef02c8c294a552ad10523d9c78091ce161a
diff --git a/runtime/core/exit.c b/runtime/core/exit.c
index 20e815e..d597519 100644
--- a/runtime/core/exit.c
+++ b/runtime/core/exit.c
@@ -175,7 +175,7 @@
{
unsigned long fipa = rec->regs[1];
- assert(rtt_level <= RTT_PAGE_LEVEL);
+ assert(rtt_level <= (unsigned long)RTT_PAGE_LEVEL);
/*
* Setup Exception Syndrom Register to emulate a real data abort
diff --git a/runtime/core/handler.c b/runtime/core/handler.c
index 560aa9f..50e655e 100644
--- a/runtime/core/handler.c
+++ b/runtime/core/handler.c
@@ -16,10 +16,10 @@
#include <utils_def.h>
/* Maximum number of supported arguments */
-#define MAX_NUM_ARGS 5
+#define MAX_NUM_ARGS 5U
/* Maximum number of output values */
-#define MAX_NUM_OUTPUT_VALS 4
+#define MAX_NUM_OUTPUT_VALS 4U
#define RMI_STATUS_STRING(_id)[RMI_##_id] = #_id
diff --git a/runtime/rmi/realm.c b/runtime/rmi/realm.c
index e58e664..4f2f667 100644
--- a/runtime/rmi/realm.c
+++ b/runtime/rmi/realm.c
@@ -72,7 +72,7 @@
*/
static bool s2_inconsistent_sl(unsigned int ipa_bits, int sl)
{
- int levels = RTT_PAGE_LEVEL - sl;
+ unsigned int levels = (unsigned int)(RTT_PAGE_LEVEL - sl);
unsigned int sl_min_ipa_bits, sl_max_ipa_bits;
/*
@@ -141,7 +141,7 @@
{
unsigned long current_ipa = 0U;
struct granule *g_rtt = rd->s2_ctx.g_rtt;
- int levels = RTT_PAGE_LEVEL - rd->s2_ctx.s2_starting_level;
+ unsigned int levels = RTT_PAGE_LEVEL - rd->s2_ctx.s2_starting_level;
/*
* The size of the IPA space that is covered by one S2TTE at
@@ -301,7 +301,7 @@
struct granule **p_g_rtt_base)
{
struct granule *g_rd = NULL, *g_rtt_base = NULL;
- int i = 0;
+ unsigned int i = 0U;
if (rd_addr < rtt_base_addr) {
g_rd = find_lock_granule(rd_addr, GRANULE_STATE_DELEGATED);
@@ -319,7 +319,7 @@
goto out_err;
}
- if (i == 0) {
+ if (i == 0U) {
g_rtt_base = g_rtt;
}
}
@@ -337,7 +337,7 @@
return true;
out_err:
- for (i = i - 1; i >= 0; i--) {
+ while (i-- != 0U) {
granule_unlock(g_rtt_base + i);
}
diff --git a/runtime/rmi/rtt.c b/runtime/rmi/rtt.c
index 49850de..1f8a881 100644
--- a/runtime/rmi/rtt.c
+++ b/runtime/rmi/rtt.c
@@ -997,7 +997,8 @@
{
struct granule *g_src;
- if (flags != RMI_NO_MEASURE_CONTENT && flags != RMI_MEASURE_CONTENT) {
+ if ((flags != RMI_NO_MEASURE_CONTENT) &&
+ (flags != RMI_MEASURE_CONTENT)) {
return RMI_ERROR_INPUT;
}
diff --git a/runtime/rsi/logger.c b/runtime/rsi/logger.c
index aca1941..60dab92 100644
--- a/runtime/rsi/logger.c
+++ b/runtime/rsi/logger.c
@@ -98,7 +98,7 @@
break;
}
- assert((cnt > 0) && (cnt < (int)(MAX_NAME_LEN + 1)));
+ assert((cnt > 0) && (cnt < (int)(MAX_NAME_LEN + 1U)));
(void)memset(buf + cnt, (int)' ', MAX_NAME_LEN - (size_t)cnt);