John Zhao has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/45623 )
Change subject: ec/kontron: Fix control flow DEADCODE issue ......................................................................
Patch Set 4:
Patch Set 4:
Seems like it might be simpler to have something like #if KEMPLD_CLK < 0 || KEMPLD_I2C_FREQ_STD < 0 #error Check your KEMPLD_CLK and KEMPLD_I2C_FREQ_STD definitions #endif
That would avoid the dead code and still prevent negative prescaler values here. what do you think?
Apart from the signs of KEMPLD_CLK and KEMPLD_I2C_FREQ_STD, prescale is determined by the following calculation "KEMPLD_CLK / (KEMPLD_I2C_FREQ_STD * 5) - 1000" or "KEMPLD_CLK / (KEMPLD_I2C_FREQ_STD * 4) - 3000". Based on current KEMPLD_CLK & KEMPLD_I2C_FREQ_STD definitions, prescale won't be negative which is why Coverity complains about the DEADCODE. It seems checking the signs of KEMPLD_CLK and KEMPLD_I2C_FREQ_STD does not help to address this DEADCODE issue.