diff options
-rw-r--r-- | host/arch/arm/lib/crossystem_arch.c | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/host/arch/arm/lib/crossystem_arch.c b/host/arch/arm/lib/crossystem_arch.c index 1cb51c24..d1030c89 100644 --- a/host/arch/arm/lib/crossystem_arch.c +++ b/host/arch/arm/lib/crossystem_arch.c @@ -231,17 +231,14 @@ static int VbGetVarGpio(const char* name) { ret = ReadFdtBlock(name, &pp, &proplen); if (ret || !pp || proplen != 12) { - ret = -1; + ret = 2; goto out; } prop = pp; gpio_num = ntohl(prop[1]); polarity = ntohl(prop[2]); - if (gpio_num) - ret = VbGetGpioStatus(gpio_num) ^ polarity ^ 1; - else - ret = -1; + ret = VbGetGpioStatus(gpio_num) ^ polarity ^ 1; out: if (pp) free(pp); @@ -361,8 +358,6 @@ VbSharedDataHeader *VbSharedDataRead(void) { } int VbGetArchPropertyInt(const char* name) { - int value; - if (!strcasecmp(name, "fmap_base")) return ReadFdtInt("fmap-offset"); else if (!strcasecmp(name, "devsw_boot")) @@ -372,26 +367,15 @@ int VbGetArchPropertyInt(const char* name) { else if (!strcasecmp(name, "wpsw_boot")) return ReadFdtBool("boot-write-protect-switch"); else if (!strcasecmp(name, "devsw_cur")) - value = VbGetVarGpio("developer-switch"); + return VbGetVarGpio("developer-switch"); else if (!strcasecmp(name, "recoverysw_cur")) - value = VbGetVarGpio("recovery-switch"); + return VbGetVarGpio("recovery-switch"); else if (!strcasecmp(name, "wpsw_cur")) - return VbGetVarGpio("write-protect-switch"); + return VbGetVarGpio("write-protect-switch"); else if (!strcasecmp(name, "recoverysw_ec_boot")) return 0; else return -1; - - if (value < 0) { - if (!strcasecmp(name, "devsw_cur")) - return ReadFdtBool("boot-developer-switch"); - else if (!strcasecmp(name, "recoverysw_cur")) - return ReadFdtBool("boot-recovery-switch"); - else - return -1; - } else { - return value; - } } const char* VbGetArchPropertyString(const char* name, char* dest, int size) { |