From 241f8745459ae413ca22fcc0f1081da8de48796f Mon Sep 17 00:00:00 2001 From: Yann Gautier Date: Tue, 21 Dec 2021 17:56:52 +0100 Subject: [PATCH] fix(stm32mp1): properly check PSCI functions return The psci_get_pstate_* helpers return unsigned int values, update the code accordingly. Remove the useless pstate variable. This corrects MISRA C2012-14.4: The controlling expression of an if statement and the controlling expression of an iteration-statement shall have essentially Boolean type. Change-Id: Idc7e756f4ba2bc0d66a327763013f77f86fe16b2 Signed-off-by: Yann Gautier --- plat/st/stm32mp1/stm32mp1_pm.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/plat/st/stm32mp1/stm32mp1_pm.c b/plat/st/stm32mp1/stm32mp1_pm.c index 8e1c1cf99..ff2218fd3 100644 --- a/plat/st/stm32mp1/stm32mp1_pm.c +++ b/plat/st/stm32mp1/stm32mp1_pm.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2023, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2015-2023, Arm Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -161,17 +161,15 @@ static void __dead2 stm32_system_reset(void) static int stm32_validate_power_state(unsigned int power_state, psci_power_state_t *req_state) { - int pstate = psci_get_pstate_type(power_state); - - if (pstate != 0) { + if (psci_get_pstate_type(power_state) != 0U) { return PSCI_E_INVALID_PARAMS; } - if (psci_get_pstate_pwrlvl(power_state)) { + if (psci_get_pstate_pwrlvl(power_state) != 0U) { return PSCI_E_INVALID_PARAMS; } - if (psci_get_pstate_id(power_state)) { + if (psci_get_pstate_id(power_state) != 0U) { return PSCI_E_INVALID_PARAMS; }