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)
This commit is contained in:
Patrick Georgi 2014-11-24 21:59:03 +01:00 committed by Patrick Georgi
parent f0c73ac341
commit 80b880fa91
1 changed files with 2 additions and 2 deletions

View File

@ -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 {