From f4707a3c40bfc752a24c427263f7cbe8d7adfcd6 Mon Sep 17 00:00:00 2001 From: Vasily Khoruzhick Date: Fri, 15 Nov 2019 08:25:02 -0800 Subject: [PATCH] plat/rockchip: initialize reset and poweroff GPIOs with known invalid value And return NULL if we didn't get them in bl aux params otherwise reset and poweroff will be broken on platforms that do not have reset and poweroff GPIOs. Fixes: c1185ffde17c ("plat/rockchip: Switch to use new common BL aux parameter library") Signed-off-by: Vasily Khoruzhick --- plat/rockchip/common/params_setup.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/plat/rockchip/common/params_setup.c b/plat/rockchip/common/params_setup.c index 8c2e5e911b..b2fd2011e4 100644 --- a/plat/rockchip/common/params_setup.c +++ b/plat/rockchip/common/params_setup.c @@ -6,6 +6,7 @@ #include #include +#include #include #include @@ -21,8 +22,8 @@ #include #include -static struct bl_aux_gpio_info rst_gpio; -static struct bl_aux_gpio_info poweroff_gpio; +static struct bl_aux_gpio_info rst_gpio = { .index = UINT_MAX } ; +static struct bl_aux_gpio_info poweroff_gpio = { .index = UINT_MAX }; static struct bl_aux_gpio_info suspend_gpio[10]; uint32_t suspend_gpio_cnt; static struct bl_aux_rk_apio_info suspend_apio; @@ -174,11 +175,17 @@ uint32_t rockchip_get_uart_clock(void) struct bl_aux_gpio_info *plat_get_rockchip_gpio_reset(void) { + if (rst_gpio.index == UINT_MAX) + return NULL; + return &rst_gpio; } struct bl_aux_gpio_info *plat_get_rockchip_gpio_poweroff(void) { + if (poweroff_gpio.index == UINT_MAX) + return NULL; + return &poweroff_gpio; }