summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPatrick Georgi <patrick@georgi-clan.de>2014-11-24 21:59:03 +0100
committerPatrick Georgi <pgeorgi@google.com>2014-11-25 12:55:39 +0100
commit80b880fa912164a3e77a02ad8cf24f64f31f065d (patch)
tree3f0d9ab97153a5aac8e0aaaba29aaf71c120dbde /src
parentf0c73ac341511427ae36d0e40293b5c0fc24abd4 (diff)
downloadcoreboot-80b880fa912164a3e77a02ad8cf24f64f31f065d.tar.xz
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 <pgeorgi@google.com> Reviewed-on: http://review.coreboot.org/7577 Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com> Tested-by: build bot (Jenkins)
Diffstat (limited to 'src')
-rw-r--r--src/mainboard/google/butterfly/chromeos.c4
1 files changed, 2 insertions, 2 deletions
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 {