[U-Boot] [PATCH 2/2] mxssb: fix uninitialized variables warnings

Marc Kleine-Budde mkl at pengutronix.de
Tue Nov 18 10:33:46 CET 2014


These warning are generated by: gcc version 4.9.1 (Debian 4.9.1-19)

mxssb.c: In function ‘main’:
mxssb.c:1580:10: warning: ‘ilen’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    ret = sb_build_dcd_block(ictx, cmd, SB_DCD_CHK_EQ | ilen);
          ^
mxssb.c:1553:12: note: ‘ilen’ was declared here
   uint32_t ilen;
            ^
mxssb.c:1556:28: warning: ‘rptr’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   if (!tok || (strlen(tok) == 0) || (lptr && strlen(lptr) != 1)) {
                            ^
mxssb.c:1495:8: note: ‘rptr’ was declared here
  char *rptr;
        ^

Signed-off-by: Marc Kleine-Budde <mkl at pengutronix.de>
---
 mxssb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mxssb.c b/mxssb.c
index 14826e7bf84c..3a4c32cf47c9 100644
--- a/mxssb.c
+++ b/mxssb.c
@@ -1492,7 +1492,7 @@ static int sb_parse_line(struct sb_image_ctx *ictx, struct sb_cmd_list *cmd)
 {
 	char *tok;
 	char *line = cmd->cmd;
-	char *rptr;
+	char *rptr = NULL;
 	int ret;
 
 	/* Analyze the identifier on this line first. */
@@ -1550,7 +1550,7 @@ static int sb_parse_line(struct sb_image_ctx *ictx, struct sb_cmd_list *cmd)
 		}
 	} else if (ictx->in_dcd) {
 		char *lptr;
-		uint32_t ilen;
+		uint32_t ilen = 0;
 
 		tok = strtok_r(tok, ".", &lptr);
 		if (!tok || (strlen(tok) == 0) || (lptr && strlen(lptr) != 1)) {
-- 
2.1.3



More information about the U-Boot mailing list