[Skiboot] [PATCH 2/3] rhesus: Fix uninitialised variable warning
Joel Stanley
joel at jms.id.au
Thu May 7 16:41:24 AEST 2015
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 at jms.id.au>
---
platforms/rhesus/rhesus.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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 */
--
2.1.4
More information about the Skiboot
mailing list