fix(xilinx): typecast operands to match data type

This corrects the MISRA violation C2012-10.1:
Operands shall not be of an inappropriate essential type.
The condition is explicitly checked against 0U, appending 'U' and
typecasting for unsigned comparison.

Change-Id: I675f1b2ac408b70a9ca307fb5161ebb8e597897c
Signed-off-by: Nithin G <nithing@amd.com>
Signed-off-by: Maheedhar Bollapalli <maheedharsai.bollapalli@amd.com>
This commit is contained in:
Maheedhar Bollapalli 2024-04-24 12:53:28 +05:30
parent 2863b0c466
commit 7d15b94ba3
4 changed files with 10 additions and 10 deletions

View file

@ -29,7 +29,7 @@
********************************************************************/
#define IPI_SECURE_MASK (0x1U)
#define IPI_IS_SECURE(I) ((ipi_table[(I)].secure_only & \
IPI_SECURE_MASK) ? 1 : 0)
IPI_SECURE_MASK) ? true : false)
/*********************************************************************
* Struct definitions

View file

@ -90,11 +90,11 @@ int ipi_mb_validate(uint32_t local, uint32_t remote, unsigned int is_secure)
{
int ret = 0;
if (!is_ipi_mb_within_range(local, remote)) {
if (is_ipi_mb_within_range(local, remote) == 0) {
ret = -EINVAL;
} else if (IPI_IS_SECURE(local) && !is_secure) {
} else if (IPI_IS_SECURE(local) && (is_secure == 0U)) {
ret = -EPERM;
} else if (IPI_IS_SECURE(remote) && !is_secure) {
} else if (IPI_IS_SECURE(remote) && (is_secure == 0U)) {
ret = -EPERM;
} else {
/* To fix the misra 15.7 warning */

View file

@ -106,9 +106,9 @@ uint64_t ipi_smc_handler(uint32_t smc_fid, uint64_t x1, uint64_t x2,
SMC_RET1(handle, 0);
case IPI_MAILBOX_STATUS_ENQUIRY:
{
int32_t disable_interrupt;
bool disable_interrupt;
disable_interrupt = (x3 & IPI_SMC_ENQUIRY_DIRQ_MASK) ? 1 : 0;
disable_interrupt = ((x3 & IPI_SMC_ENQUIRY_DIRQ_MASK) != 0U);
ret = ipi_mb_enquire_status(ipi_local_id, ipi_remote_id);
if ((((uint32_t)ret & IPI_MB_STATUS_RECV_PENDING) > 0U) && disable_interrupt)
ipi_mb_disable_irq(ipi_local_id, ipi_remote_id);
@ -118,15 +118,15 @@ uint64_t ipi_smc_handler(uint32_t smc_fid, uint64_t x1, uint64_t x2,
{
uint32_t is_blocking;
is_blocking = (x3 & IPI_SMC_NOTIFY_BLOCK_MASK) ? 1 : 0;
is_blocking = ((x3 & IPI_SMC_NOTIFY_BLOCK_MASK) != 0U);
ipi_mb_notify(ipi_local_id, ipi_remote_id, is_blocking);
SMC_RET1(handle, 0);
}
case IPI_MAILBOX_ACK:
{
int32_t enable_interrupt;
bool enable_interrupt;
enable_interrupt = (x3 & IPI_SMC_ACK_EIRQ_MASK) ? 1 : 0;
enable_interrupt = ((x3 & IPI_SMC_ACK_EIRQ_MASK) != 0U);
ipi_mb_ack(ipi_local_id, ipi_remote_id);
if (enable_interrupt != 0)
ipi_mb_enable_irq(ipi_local_id, ipi_remote_id);

View file

@ -175,7 +175,7 @@ enum xbl_handoff xbl_handover(entry_point_info_t *bl32,
{
const struct xbl_handoff_params *HandoffParams;
if (!handoff_addr) {
if (handoff_addr == 0U) {
WARN("BL31: No handoff structure passed\n");
return XBL_HANDOFF_NO_STRUCT;
}