[Skiboot] [PATCH 4/6] libflash: Fix Coverity defect 97867

Cyril Bur cyril.bur at au1.ibm.com
Tue Sep 8 16:14:01 AEST 2015


CID 97867 (#1 of 1): Uninitialized scalar variable (UNINIT)
5. uninit_use: Using uninitialized value rc.

Signed-off-by: Cyril Bur <cyril.bur at au1.ibm.com>
---
 libflash/libflash.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libflash/libflash.c b/libflash/libflash.c
index c43f212..c05c927 100644
--- a/libflash/libflash.c
+++ b/libflash/libflash.c
@@ -694,7 +694,7 @@ static int flash_set_4b(struct flash_chip *c, bool enable)
 int flash_force_4b_mode(struct flash_chip *c, bool enable_4b)
 {
 	struct spi_flash_ctrl *ct = c->ctrl;
-	int rc;
+	int rc = FLASH_ERR_4B_NOT_SUPPORTED;
 
 	/*
 	 * We only allow force 4b if both controller and flash do 4b
@@ -702,7 +702,7 @@ int flash_force_4b_mode(struct flash_chip *c, bool enable_4b)
 	 * access a direct mapped read region
 	 */
 	if (enable_4b && !((c->info.flags & FL_CAN_4B) && ct->set_4b))
-		return FLASH_ERR_4B_NOT_SUPPORTED;
+		return rc;
 
 	/* Only send to flash directly on controllers that implement
 	 * the low level callbacks
-- 
2.5.1



More information about the Skiboot mailing list