intel: Fix Coverity Scan Defects
Fix mailbox driver incompatible cast bug and control flow issue that
was flagged by Coverity Scan.
Signed-off-by: Abdul Halim, Muhammad Hadi Asyrafi <muhammad.hadi.asyrafi.abdul.halim@intel.com>
Change-Id: I3f34e98d24e40139d31cf7d5b9b973cd2d981065
diff --git a/plat/intel/soc/common/socfpga_sip_svc.c b/plat/intel/soc/common/socfpga_sip_svc.c
index 5b600e5..1c3d45b 100644
--- a/plat/intel/soc/common/socfpga_sip_svc.c
+++ b/plat/intel/soc/common/socfpga_sip_svc.c
@@ -61,7 +61,7 @@
static int intel_fpga_sdm_write_buffer(struct fpga_config_info *buffer)
{
- uint32_t args[3];
+ uint64_t args[3];
while (max_blocks > 0 && buffer->size > buffer->size_written) {
args[0] = (1<<8);
@@ -256,7 +256,7 @@
{
if (size > (UINT64_MAX - addr))
return false;
- if (addr < DRAM_BASE)
+ if (addr < BL31_LIMIT)
return false;
if (addr + size > DRAM_BASE + DRAM_SIZE)
return false;
@@ -387,7 +387,7 @@
static uint32_t intel_rsu_notify(uint64_t execution_stage)
{
- if (mailbox_hps_stage_notify((uint32_t)execution_stage) < 0)
+ if (mailbox_hps_stage_notify(execution_stage) < 0)
return INTEL_SIP_SMC_STATUS_ERROR;
return INTEL_SIP_SMC_STATUS_OK;
@@ -404,7 +404,7 @@
}
/* Mailbox services */
-static uint32_t intel_mbox_send_cmd(uint32_t cmd, uint32_t *args, int len,
+static uint32_t intel_mbox_send_cmd(uint32_t cmd, uint64_t *args, int len,
int urgent, uint32_t *response,
int resp_len, int *mbox_status,
int *len_in_resp)
@@ -542,7 +542,7 @@
case INTEL_SIP_SMC_MBOX_SEND_CMD:
x5 = SMC_GET_GP(handle, CTX_GPREG_X5);
x6 = SMC_GET_GP(handle, CTX_GPREG_X6);
- status = intel_mbox_send_cmd(x1, (uint32_t *)x2, x3, x4,
+ status = intel_mbox_send_cmd(x1, (uint64_t *)x2, x3, x4,
(uint32_t *)x5, x6, &mbox_status,
&len_in_resp);
SMC_RET4(handle, status, mbox_status, x5, len_in_resp);