Patchwork [2/2] mkfs.ubifs: fix a gcc warning

login
register
mail settings
Submitter Artem Bityutskiy
Date July 4, 2011, 6:59 a.m.
Message ID <1309762745-20175-2-git-send-email-dedekind1@gmail.com>
Download mbox | patch
Permalink /patch/103041/
State New
Headers show

Comments

Artem Bityutskiy - July 4, 2011, 6:59 a.m.
This patch "fixes" the following gcc warning:

mkfs.ubifs/mkfs.ubifs.c: In function ‘main’:
mkfs.ubifs/ubifs.h:420:2: warning: ‘child_cnt’ may be used uninitialized in this function [-Wuninitialized]
mkfs.ubifs/mkfs.ubifs.c:1735:6: note: ‘child_cnt’ was declared here

by initializing the ‘child_cnt’ to zero.

Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
---
 mkfs.ubifs/mkfs.ubifs.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Patch

diff --git a/mkfs.ubifs/mkfs.ubifs.c b/mkfs.ubifs/mkfs.ubifs.c
index 79cc71d..dcdb722 100644
--- a/mkfs.ubifs/mkfs.ubifs.c
+++ b/mkfs.ubifs/mkfs.ubifs.c
@@ -1732,7 +1732,7 @@  static int write_index(void)
 	struct idx_entry **idx_ptr, **p;
 	struct ubifs_idx_node *idx;
 	struct ubifs_branch *br;
-	int child_cnt, j, level, blnum, boffs, blen, blast_len, err;
+	int child_cnt = 0, j, level, blnum, boffs, blen, blast_len, err;
 
 	dbg_msg(1, "leaf node count: %zd", idx_cnt);