From 80b880fa912164a3e77a02ad8cf24f64f31f065d Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Mon, 24 Nov 2014 21:59:03 +0100 Subject: google/butterfly: fix off-by-one issues GPIOs 32 and 64 used the wrong code path. Change-Id: I1d293cf38844b477cac67bc19ce5e5c92a6e93ca Found-by: Coverity Scan Signed-off-by: Patrick Georgi Reviewed-on: http://review.coreboot.org/7577 Reviewed-by: Paul Menzel Reviewed-by: Edward O'Callaghan Tested-by: build bot (Jenkins) --- src/mainboard/google/butterfly/chromeos.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/mainboard/google/butterfly') diff --git a/src/mainboard/google/butterfly/chromeos.c b/src/mainboard/google/butterfly/chromeos.c index 61097c39fb..ecb128880f 100644 --- a/src/mainboard/google/butterfly/chromeos.c +++ b/src/mainboard/google/butterfly/chromeos.c @@ -112,10 +112,10 @@ int get_pch_gpio(unsigned char gpio_num) if (!gpio_base) return(0); - if (gpio_num > 64){ + if (gpio_num >= 64){ u32 gp_lvl3 = inl(gpio_base + GP_LVL3); retval = ((gp_lvl3 >> (gpio_num - 64)) & 1); - } else if (gpio_num > 32){ + } else if (gpio_num >= 32){ u32 gp_lvl2 = inl(gpio_base + GP_LVL2); retval = ((gp_lvl2 >> (gpio_num - 32)) & 1); } else { -- cgit v1.2.3