diff mbox

[3/3] astbmc: Fix uninitialised variable warning

Message ID 1430980885-639-4-git-send-email-joel@jms.id.au
State Accepted
Headers show

Commit Message

Joel Stanley May 7, 2015, 6:41 a.m. UTC
platforms/astbmc/pnor.c:43:6: error: variable 'pnor_chip' is used uninitialized whenever 'if' condition is true
      [-Werror,-Wsometimes-uninitialized]
        if (rc) {
            ^~
platforms/astbmc/pnor.c:58:6: note: uninitialized use occurs here
        if (pnor_chip)
            ^~~~~~~~~
platforms/astbmc/pnor.c:43:2: note: remove the 'if' if its condition is always false
        if (rc) {
        ^~~~~~~~~
platforms/astbmc/pnor.c:30:30: note: initialize the variable 'pnor_chip' to silence this warning
        struct flash_chip *pnor_chip;
                                    ^
                                     = NULL

Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 platforms/astbmc/pnor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/platforms/astbmc/pnor.c b/platforms/astbmc/pnor.c
index 8e88edd..d294c1f 100644
--- a/platforms/astbmc/pnor.c
+++ b/platforms/astbmc/pnor.c
@@ -27,7 +27,7 @@ 
 int pnor_init(void)
 {
 	struct spi_flash_ctrl *pnor_ctrl;
-	struct flash_chip *pnor_chip;
+	struct flash_chip *pnor_chip = NULL;
 	int rc;
 
 	/* Open controller and flash. If the LPC->AHB doesn't point to