summaryrefslogtreecommitdiff
path: root/src/soc/mediatek
diff options
context:
space:
mode:
authorJarried Lin <jarried.lin@mediatek.corp-partner.google.com>2024-08-20 17:33:49 +0800
committerFelix Held <felix-coreboot@felixheld.de>2024-08-23 14:33:23 +0000
commitd2328698ac26961b9d4d7259c3fb83453a5945dd (patch)
tree643a54604b4064f042c0069fbd0a27c5a9d90e03 /src/soc/mediatek
parent2f3d534eeaf8683ca60de3118c820bc32b03d070 (diff)
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 <jarried.lin@mediatek.corp-partner.google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/83987 Reviewed-by: Yu-Ping Wu <yupingso@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Yidi Lin <yidilin@google.com>
Diffstat (limited to 'src/soc/mediatek')
-rw-r--r--src/soc/mediatek/common/gpio.c16
1 files changed, 12 insertions, 4 deletions
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;