From d432506509ba86585e2d29de7e1c16df2ff8a549 Mon Sep 17 00:00:00 2001 From: Moritz Fischer Date: Tue, 5 Jan 2016 14:56:41 -0800 Subject: firmware: e3xx: This fixes an issue with the autoboot value. The bug is a result of wrong order of evaluation: The '|' operator takes precedence over '?'. Therefore the intended expression a = x | (y ? 1 : 0) got evaluated as a = (x | y) ? 1 : 0. Signed-off-by: Moritz Fischer --- firmware/e300/battery/fpga.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'firmware') diff --git a/firmware/e300/battery/fpga.c b/firmware/e300/battery/fpga.c index 20404e5a1..2dc9fb09d 100644 --- a/firmware/e300/battery/fpga.c +++ b/firmware/e300/battery/fpga.c @@ -248,7 +248,8 @@ void fpga_init(void) fpga_tx2.type = 2; /* get autoboot value from eeprom, keep TX reg on */ - fpga_tx2.settings = BIT(1) | eeprom_get_autoboot() ? 0x1 : 0x0; + fpga_tx2.settings = BIT(1); + fpga_tx2.settings |= eeprom_get_autoboot() ? BIT(0) : 0x0; memset((void *) &fpga_rx, 0, sizeof(fpga_rx)); -- cgit v1.2.3