From d2328698ac26961b9d4d7259c3fb83453a5945dd Mon Sep 17 00:00:00 2001 From: Jarried Lin Date: Tue, 20 Aug 2024 17:33:49 +0800 Subject: soc/mediatek/common: Print error if GPIO raw_id is not in the range TEST=build pass BUG=317009620 Change-Id: I5dffdb9f3e4e7e0d49209e6012893cd246948ee8 Signed-off-by: Jarried Lin Reviewed-on: https://review.coreboot.org/c/coreboot/+/83987 Reviewed-by: Yu-Ping Wu Tested-by: build bot (Jenkins) Reviewed-by: Yidi Lin --- src/soc/mediatek/common/gpio.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/soc') diff --git a/src/soc/mediatek/common/gpio.c b/src/soc/mediatek/common/gpio.c index bbfbb3d175..3dfdf92da0 100644 --- a/src/soc/mediatek/common/gpio.c +++ b/src/soc/mediatek/common/gpio.c @@ -189,8 +189,10 @@ int gpio_set_driving(gpio_t gpio, uint8_t drv) const struct gpio_drv_info *adv_info = get_gpio_driving_adv_info(gpio.id); void *reg, *reg_adv, *reg_addr; - if (!info) + if (!info) { + printk(BIOS_ERR, "%s: raw_id %u is out of range\n", __func__, gpio.id); return -1; + } if (!is_valid_drv(drv)) return -1; @@ -221,8 +223,10 @@ int gpio_get_driving(gpio_t gpio) const struct gpio_drv_info *info = get_gpio_driving_info(gpio.id); void *reg; - if (!info) + if (!info) { + printk(BIOS_ERR, "%s: raw_id %u is out of range\n", __func__, gpio.id); return -1; + } if (info->width == 0) return -1; @@ -237,8 +241,10 @@ int gpio_set_driving_adv(gpio_t gpio, enum gpio_drv_adv drv) const struct gpio_drv_info *adv_info = get_gpio_driving_adv_info(gpio.id); void *reg_adv; - if (!adv_info) + if (!adv_info) { + printk(BIOS_ERR, "%s: raw_id %u is out of range\n", __func__, gpio.id); return -1; + } if (!is_valid_drv_adv(drv)) return -1; @@ -266,8 +272,10 @@ int gpio_get_driving_adv(gpio_t gpio) void *reg_adv; uint32_t drv; - if (!adv_info) + if (!adv_info) { + printk(BIOS_ERR, "%s: raw_id %u is out of range\n", __func__, gpio.id); return -1; + } if (adv_info->width == 0) return -1; -- cgit v1.2.3