diff mbox

[2/3] rhesus: Fix uninitialised variable warning

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

Commit Message

Joel Stanley May 7, 2015, 6:41 a.m. UTC
platforms/rhesus/rhesus.c:126:6: error: variable 'pnor_chip' is used uninitialized whenever 'if' condition is true
      [-Werror,-Wsometimes-uninitialized]
        if (rc) {
            ^~
platforms/rhesus/rhesus.c:141:6: note: uninitialized use occurs here
        if (pnor_chip)
            ^~~~~~~~~
platforms/rhesus/rhesus.c:126:2: note: remove the 'if' if its condition is always false
        if (rc) {
        ^~~~~~~~~
platforms/rhesus/rhesus.c:121: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/rhesus/rhesus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/platforms/rhesus/rhesus.c b/platforms/rhesus/rhesus.c
index 50769cf..27e1c91 100644
--- a/platforms/rhesus/rhesus.c
+++ b/platforms/rhesus/rhesus.c
@@ -118,7 +118,7 @@  static int64_t rhesus_power_down(uint64_t request __unused)
 static int rhesus_pnor_init(void)
 {
 	struct spi_flash_ctrl *pnor_ctrl;
-	struct flash_chip *pnor_chip;
+	struct flash_chip *pnor_chip = NULL;
 	int rc;
 
 	/* Open controller, flash and ffs */