fix(versal2): typecast operands to match data type
This corrects the MISRA violation C2012-10.3:
The value of an expression shall not be assigned to an object with a
narrower essential type or of a different essential type category.
The condition is explicitly checked against 0U, appending 'U' and
typecasting for unsigned comparison.
Change-Id: I37ec9f8d716347df9acea5eb084f5a423a32a058
Signed-off-by: Maheedhar Bollapalli <maheedharsai.bollapalli@amd.com>
diff --git a/plat/amd/versal2/scmi.c b/plat/amd/versal2/scmi.c
index fa0b2ca..eec8205 100644
--- a/plat/amd/versal2/scmi.c
+++ b/plat/amd/versal2/scmi.c
@@ -328,7 +328,7 @@
unsigned long rate)
{
struct scmi_clk *clock = clk_find(agent_id, scmi_id);
- unsigned long ret = UL(SCMI_SUCCESS);
+ int32_t ret = SCMI_SUCCESS;
if ((clock == NULL)) {
ret = SCMI_NOT_FOUND;
@@ -564,17 +564,19 @@
unsigned int state)
{
struct scmi_pd *pd = find_pd(agent_id, pd_id);
+ int32_t ret = SCMI_SUCCESS;
if (pd == NULL) {
- return SCMI_NOT_SUPPORTED;
- }
+ ret = SCMI_NOT_SUPPORTED;
+ } else {
- NOTICE("SCMI: PD: set id: %d, orig state: %x, new state: %x, flags: %x\n",
- pd_id, pd->state, state, flags);
+ NOTICE("SCMI: PD: set id: %d, orig state: %x, new state: %x, flags: %x\n",
+ pd_id, pd->state, state, flags);
- pd->state = state;
+ pd->state = state;
+ }
- return 0U;
+ return ret;
}