[coreboot-gerrit] Patch set updated for coreboot: soc/mediatek/mt8173/spi.c: Change assert to if statement
Martin Roth (martinroth@google.com)
gerrit at coreboot.org
Fri Nov 18 20:44:36 CET 2016
Martin Roth (martinroth at google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17484
-gerrit
commit cb2a27236dc1bfa01adb569f60c8a0cb88ec83e4
Author: Martin Roth <martinroth at google.com>
Date: Fri Nov 18 09:54:23 2016 -0700
soc/mediatek/mt8173/spi.c: Change assert to if statement
Asserts are only fatal if CONFIG_FATAL_ASSERTS is enabled in Kconfig.
By default this is disabled, so the assert is generally just a printf.
This error doesn't need to be fatal anyway, so just return if the code
tries to initialize a bus above 0.
Addresses coverity issue 1349858 - Out-of-bounds read
Signed-off-by: Martin Roth <martinroth at google.com>
Change-Id: I9d79bc336cbbfde31f655cfd271f101e7a90ab1b
---
src/soc/mediatek/mt8173/spi.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/soc/mediatek/mt8173/spi.c b/src/soc/mediatek/mt8173/spi.c
index c35b1fc..cb2c46c 100644
--- a/src/soc/mediatek/mt8173/spi.c
+++ b/src/soc/mediatek/mt8173/spi.c
@@ -81,7 +81,10 @@ void mtk_spi_init(unsigned int bus, unsigned int pad_select,
{
u32 div, sck_ticks, cs_ticks, reg_val;
/* mtk spi HW just support bus 0 */
- assert(bus == 0);
+ if (bus != 0){
+ printk(BIOS_ERR, "Error: Only SPI bus 0 is supported.\n");
+ return;
+ }
struct mtk_spi_bus *slave = &spi_bus[bus];
struct mtk_spi_regs *regs = slave->regs;
More information about the coreboot-gerrit
mailing list