aboutsummaryrefslogtreecommitdiffstats
path: root/lib/psci/psci_common.c
diff options
context:
space:
mode:
authorDeepika Bhavnani <deepika.bhavnani@arm.com>2019-08-27 00:32:24 +0300
committerDeepika Bhavnani <deepika.bhavnani@arm.com>2019-09-13 01:30:03 +0300
commitfc81021aedf01a922686bc9fa22de411ec80592b (patch)
treeed06b974d7bf61e1d52b56a70e9f4b305d0965a0 /lib/psci/psci_common.c
parent5dbdf8e4eac1d5999f07976f9f430894b0784907 (diff)
downloadplatform_external_arm-trusted-firmware-fc81021aedf01a922686bc9fa22de411ec80592b.tar.gz
platform_external_arm-trusted-firmware-fc81021aedf01a922686bc9fa22de411ec80592b.tar.bz2
platform_external_arm-trusted-firmware-fc81021aedf01a922686bc9fa22de411ec80592b.zip
Unify type of "cpu_idx" across PSCI module.
cpu_idx is used as mix of `unsigned int` and `signed int` in code with typecasting at some places. This change is to unify the cpu_idx as `unsigned int` as underlying API;s `plat_my_core_pos` returns `unsigned int` It was discovered via coverity issue CID 354715 Signed-off-by: Deepika Bhavnani <deepika.bhavnani@arm.com> Change-Id: I4f0adb0c596ff1177210c5fe803bff853f2e54ce
Diffstat (limited to 'lib/psci/psci_common.c')
-rw-r--r--lib/psci/psci_common.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/psci/psci_common.c b/lib/psci/psci_common.c
index 022c87751..3bfa06852 100644
--- a/lib/psci/psci_common.c
+++ b/lib/psci/psci_common.c
@@ -159,9 +159,10 @@ void psci_query_sys_suspend_pwrstate(psci_power_state_t *state_info)
******************************************************************************/
unsigned int psci_is_last_on_cpu(void)
{
- int cpu_idx, my_idx = (int) plat_my_core_pos();
+ unsigned int cpu_idx, my_idx = plat_my_core_pos();
- for (cpu_idx = 0; cpu_idx < PLATFORM_CORE_COUNT; cpu_idx++) {
+ for (cpu_idx = 0; cpu_idx < (unsigned int)PLATFORM_CORE_COUNT;
+ cpu_idx++) {
if (cpu_idx == my_idx) {
assert(psci_get_aff_info_state() == AFF_STATE_ON);
continue;
@@ -206,7 +207,7 @@ static void psci_set_req_local_pwr_state(unsigned int pwrlvl,
{
assert(pwrlvl > PSCI_CPU_PWR_LVL);
if ((pwrlvl > PSCI_CPU_PWR_LVL) && (pwrlvl <= PLAT_MAX_PWR_LVL) &&
- (cpu_idx < PLATFORM_CORE_COUNT)) {
+ (cpu_idx < (unsigned int) PLATFORM_CORE_COUNT)) {
psci_req_local_pwr_states[pwrlvl - 1U][cpu_idx] = req_pwr_state;
}
}
@@ -237,12 +238,12 @@ void __init psci_init_req_local_pwr_states(void)
* assertion is added to prevent us from accessing the CPU power level.
*****************************************************************************/
static plat_local_state_t *psci_get_req_local_pwr_states(unsigned int pwrlvl,
- int cpu_idx)
+ unsigned int cpu_idx)
{
assert(pwrlvl > PSCI_CPU_PWR_LVL);
if ((pwrlvl > PSCI_CPU_PWR_LVL) && (pwrlvl <= PLAT_MAX_PWR_LVL) &&
- (cpu_idx < PLATFORM_CORE_COUNT)) {
+ (cpu_idx < (unsigned int) PLATFORM_CORE_COUNT)) {
return &psci_req_local_pwr_states[pwrlvl - 1U][cpu_idx];
} else
return NULL;
@@ -351,7 +352,7 @@ static void psci_set_target_local_pwr_states(unsigned int end_pwrlvl,
/*******************************************************************************
* PSCI helper function to get the parent nodes corresponding to a cpu_index.
******************************************************************************/
-void psci_get_parent_pwr_domain_nodes(int cpu_idx,
+void psci_get_parent_pwr_domain_nodes(unsigned int cpu_idx,
unsigned int end_lvl,
unsigned int *node_index)
{
@@ -417,7 +418,7 @@ void psci_do_state_coordination(unsigned int end_pwrlvl,
psci_power_state_t *state_info)
{
unsigned int lvl, parent_idx, cpu_idx = plat_my_core_pos();
- int start_idx;
+ unsigned int start_idx;
unsigned int ncpus;
plat_local_state_t target_state, *req_states;
@@ -763,7 +764,7 @@ int psci_validate_entry_point(entry_point_info_t *ep,
void psci_warmboot_entrypoint(void)
{
unsigned int end_pwrlvl;
- int cpu_idx = (int) plat_my_core_pos();
+ unsigned int cpu_idx = plat_my_core_pos();
unsigned int parent_nodes[PLAT_MAX_PWR_LVL] = {0};
psci_power_state_t state_info = { {PSCI_LOCAL_STATE_RUN} };