Attention is currently required from: Hung-Te Lin, Yidi Lin, Yu-Ping Wu.
Jarried Lin has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/83987?usp=email )
Change subject: soc/mediatek: Add null check for info with error handling ......................................................................
soc/mediatek: Add null check for info with error handling
TEST=build pass BUG=317009620
Change-Id: I5dffdb9f3e4e7e0d49209e6012893cd246948ee8 Signed-off-by: Jarried Lin jarried.lin@mediatek.corp-partner.google.com --- M src/soc/mediatek/common/gpio.c 1 file changed, 17 insertions(+), 4 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/87/83987/1
diff --git a/src/soc/mediatek/common/gpio.c b/src/soc/mediatek/common/gpio.c index bbfbb3d..bc4796c 100644 --- a/src/soc/mediatek/common/gpio.c +++ b/src/soc/mediatek/common/gpio.c @@ -189,8 +189,15 @@ 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, "Error: raw_id is out of range\n"); return -1; + } + + if (!adv_info) { + printk(BIOS_ERR, "Error: raw_id is out of range\n"); + return -1; + }
if (!is_valid_drv(drv)) return -1; @@ -221,8 +228,10 @@ const struct gpio_drv_info *info = get_gpio_driving_info(gpio.id); void *reg;
- if (!info) + if (!info) { + printk(BIOS_ERR, "Error: raw_id is out of range\n"); return -1; + }
if (info->width == 0) return -1; @@ -237,8 +246,10 @@ 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, "Error: raw_id is out of range\n"); return -1; + }
if (!is_valid_drv_adv(drv)) return -1; @@ -266,8 +277,10 @@ void *reg_adv; uint32_t drv;
- if (!adv_info) + if (!adv_info) { + printk(BIOS_ERR, "Error: raw_id is out of range\n"); return -1; + }
if (adv_info->width == 0) return -1;