fix(zynqmp): typecast expression to match data type

This corrects the MISRA violation C2012-10.6:
The value of a composite expression shall not be assigned to
an object with wider essential type.
Explicitly type casted to match the data type of composite
expression.

Change-Id: I6497453f9f7455ae2f1ad8a18760ff0ef41d7c40
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-23 12:34:26 +05:30
parent 50ab13577f
commit e2cc129bcc
2 changed files with 15 additions and 14 deletions

View file

@ -2685,8 +2685,9 @@ enum pm_ret_status pm_api_clock_get_max_divisor(enum clock_id clock_id,
for (i = 0; i < clocks[clock_id].num_nodes; i++) { for (i = 0; i < clocks[clock_id].num_nodes; i++) {
if (nodes[i].type == div_type) { if (nodes[i].type == div_type) {
if ((CLK_DIVIDER_POWER_OF_TWO & if ((CLK_DIVIDER_POWER_OF_TWO &
nodes[i].typeflags) != 0U) { nodes[i].typeflags) != 0U) {
*max_div = (1U << (BIT(nodes[i].width) - 1U)); *max_div = (((uint32_t)1U <<
((uint32_t)BIT(nodes[i].width) - (uint32_t)1U)));
} else { } else {
*max_div = BIT(nodes[i].width) - 1U; *max_div = BIT(nodes[i].width) - 1U;
} }

View file

@ -266,7 +266,7 @@ static enum pm_ret_status pm_ioctl_sd_set_tapdelay(enum pm_node_id nid,
if (type == PM_TAPDELAY_INPUT) { if (type == PM_TAPDELAY_INPUT) {
ret = pm_mmio_write(ZYNQMP_SD_ITAP_DLY, ret = pm_mmio_write(ZYNQMP_SD_ITAP_DLY,
(ZYNQMP_SD_ITAPCHGWIN_MASK << shift), (uint64_t)(ZYNQMP_SD_ITAPCHGWIN_MASK << shift),
(ZYNQMP_SD_ITAPCHGWIN << shift)); (ZYNQMP_SD_ITAPCHGWIN << shift));
if (ret != PM_RET_SUCCESS) { if (ret != PM_RET_SUCCESS) {
@ -275,12 +275,12 @@ static enum pm_ret_status pm_ioctl_sd_set_tapdelay(enum pm_node_id nid,
if (value == 0U) { if (value == 0U) {
ret = pm_mmio_write(ZYNQMP_SD_ITAP_DLY, ret = pm_mmio_write(ZYNQMP_SD_ITAP_DLY,
(ZYNQMP_SD_ITAPDLYENA_MASK << (uint64_t)(ZYNQMP_SD_ITAPDLYENA_MASK <<
shift), 0); shift), 0);
} else { } else {
ret = pm_mmio_write(ZYNQMP_SD_ITAP_DLY, ret = pm_mmio_write(ZYNQMP_SD_ITAP_DLY,
(ZYNQMP_SD_ITAPDLYENA_MASK << (uint64_t)(ZYNQMP_SD_ITAPDLYENA_MASK <<
shift), (ZYNQMP_SD_ITAPDLYENA << shift), (uint64_t)(ZYNQMP_SD_ITAPDLYENA <<
shift)); shift));
} }
@ -289,7 +289,7 @@ static enum pm_ret_status pm_ioctl_sd_set_tapdelay(enum pm_node_id nid,
} }
ret = pm_mmio_write(ZYNQMP_SD_ITAP_DLY, ret = pm_mmio_write(ZYNQMP_SD_ITAP_DLY,
(ZYNQMP_SD_ITAPDLYSEL_MASK << shift), (uint64_t)(ZYNQMP_SD_ITAPDLYSEL_MASK << shift),
(value << shift)); (value << shift));
if (ret != PM_RET_SUCCESS) { if (ret != PM_RET_SUCCESS) {
@ -297,17 +297,17 @@ static enum pm_ret_status pm_ioctl_sd_set_tapdelay(enum pm_node_id nid,
} }
ret = pm_mmio_write(ZYNQMP_SD_ITAP_DLY, ret = pm_mmio_write(ZYNQMP_SD_ITAP_DLY,
(ZYNQMP_SD_ITAPCHGWIN_MASK << shift), 0); (uint64_t)(ZYNQMP_SD_ITAPCHGWIN_MASK << shift), 0);
} else if (type == PM_TAPDELAY_OUTPUT) { } else if (type == PM_TAPDELAY_OUTPUT) {
ret = pm_mmio_write(ZYNQMP_SD_OTAP_DLY, ret = pm_mmio_write(ZYNQMP_SD_OTAP_DLY,
(ZYNQMP_SD_OTAPDLYENA_MASK << shift), 0); (uint64_t)(ZYNQMP_SD_OTAPDLYENA_MASK << shift), 0);
if (ret != PM_RET_SUCCESS) { if (ret != PM_RET_SUCCESS) {
goto reset_release; goto reset_release;
} }
ret = pm_mmio_write(ZYNQMP_SD_OTAP_DLY, ret = pm_mmio_write(ZYNQMP_SD_OTAP_DLY,
(ZYNQMP_SD_OTAPDLYSEL_MASK << shift), (uint64_t)(ZYNQMP_SD_OTAPDLYSEL_MASK << shift),
(value << shift)); (value << shift));
} else { } else {
ret = PM_RET_ERROR_ARGS; ret = PM_RET_ERROR_ARGS;
@ -422,7 +422,7 @@ static enum pm_ret_status pm_ioctl_write_ggs(uint32_t index,
return PM_RET_ERROR_ARGS; return PM_RET_ERROR_ARGS;
} }
return pm_mmio_write(GGS_BASEADDR + (index << 2), return pm_mmio_write((uint64_t)(GGS_BASEADDR + (index << 2)),
0xFFFFFFFFU, value); 0xFFFFFFFFU, value);
} }
@ -444,7 +444,7 @@ static enum pm_ret_status pm_ioctl_read_ggs(uint32_t index,
return PM_RET_ERROR_ARGS; return PM_RET_ERROR_ARGS;
} }
return pm_mmio_read(GGS_BASEADDR + (index << 2), value); return pm_mmio_read((uint64_t)(GGS_BASEADDR + (index << 2)), value);
} }
/** /**
@ -465,7 +465,7 @@ static enum pm_ret_status pm_ioctl_write_pggs(uint32_t index,
return PM_RET_ERROR_ARGS; return PM_RET_ERROR_ARGS;
} }
return pm_mmio_write(PGGS_BASEADDR + (index << 2), return pm_mmio_write((uint64_t)(PGGS_BASEADDR + (index << 2)),
0xFFFFFFFFU, value); 0xFFFFFFFFU, value);
} }
@ -530,7 +530,7 @@ static enum pm_ret_status pm_ioctl_read_pggs(uint32_t index,
return PM_RET_ERROR_ARGS; return PM_RET_ERROR_ARGS;
} }
return pm_mmio_read(PGGS_BASEADDR + (index << 2), value); return pm_mmio_read((uint64_t)(PGGS_BASEADDR + (index << 2)), value);
} }
/** /**