fix(plat/st): correct signedness comparison issue

Add casts where required to avoid compialtion error when enabling
-Wsign-compare in shared resources file.
The assert is also corrected to match the correct range (change ||
to &&).

Change-Id: Ie4c9c0c935d39ff9a2165b909172aacb3e94ab4d
Signed-off-by: Yann Gautier <yann.gautier@st.com>
This commit is contained in:
Yann Gautier 2020-11-10 15:08:37 +01:00
parent 330669de94
commit 5657decc7f

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017-2020, STMicroelectronics - All Rights Reserved
* Copyright (c) 2017-2021, STMicroelectronics - All Rights Reserved
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -114,7 +114,7 @@ static unsigned int get_gpio_nbpin(unsigned int bank)
if (bank != GPIO_BANK_Z) {
int count = fdt_get_gpio_bank_pin_count(bank);
assert((count >= 0) || (count <= (GPIO_PIN_MAX + 1)));
assert((count >= 0) && ((unsigned int)count <= (GPIO_PIN_MAX + 1)));
return (unsigned int)count;
}
@ -163,7 +163,7 @@ static void register_periph(enum stm32mp_shres id, unsigned int state)
if ((id >= STM32MP1_SHRES_GPIOZ(0)) &&
(id <= STM32MP1_SHRES_GPIOZ(7)) &&
((id - STM32MP1_SHRES_GPIOZ(0)) >= get_gpioz_nbpin())) {
((unsigned int)(id - STM32MP1_SHRES_GPIOZ(0)) >= get_gpioz_nbpin())) {
ERROR("Invalid GPIO pin %u, %u pin(s) available\n",
id - STM32MP1_SHRES_GPIOZ(0), get_gpioz_nbpin());
panic();