From 22ba205f7024fd04436c1ad415c26d6961919ef4 Mon Sep 17 00:00:00 2001 From: Richard Spiegel Date: Mon, 18 Feb 2019 15:31:33 -0700 Subject: drivers/spi/spi_flash.c: Avoid static scan false positive Static scan-build indicates a possible invalid return from function spi_flash_cmd_erase(). The root cause is because the scan believes it's possible for offset to be above the end address in the first pass, thus not setting a value for variable ret. Assign initial value of -1 to variable ret to make checker happy. BUG=b:112253891 TEST=build grunt Change-Id: If548728ff90b755c69143eabff6aeff01e8fd483 Signed-off-by: Richard Spiegel Reviewed-on: https://review.coreboot.org/c/31473 Tested-by: build bot (Jenkins) Reviewed-by: Furquan Shaikh --- src/drivers/spi/spi_flash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/drivers/spi/spi_flash.c b/src/drivers/spi/spi_flash.c index 204f607889..d1f52271eb 100644 --- a/src/drivers/spi/spi_flash.c +++ b/src/drivers/spi/spi_flash.c @@ -196,7 +196,7 @@ int spi_flash_cmd_wait_ready(const struct spi_flash *flash, int spi_flash_cmd_erase(const struct spi_flash *flash, u32 offset, size_t len) { u32 start, end, erase_size; - int ret; + int ret = -1; u8 cmd[4]; erase_size = flash->sector_size; -- cgit v1.2.3