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