lib: libfdt: Fix the bug in adding new nodes.

Initialize the tag variable before use.

CRs-Fixed: 491381

Change-Id: I304854bc896e1c09dc7137d0297b95ae784b30e4
diff --git a/lib/libfdt/fdt_rw.c b/lib/libfdt/fdt_rw.c
index c929bab..9ed0d4d 100644
--- a/lib/libfdt/fdt_rw.c
+++ b/lib/libfdt/fdt_rw.c
@@ -351,8 +351,7 @@
 		return offset;
 
 	/* Try to place the new node after the parent's properties and all the sub nodes already present. */
-	fdt_next_tag(fdt, parentoffset, &nextoffset); /* skip the BEGIN_NODE */
-	count++; /* Track the BIGIN_NODEs */
+	tag = fdt_next_tag(fdt, parentoffset, &nextoffset); /* skip the BEGIN_NODE */
 	do {
 		if (tag == FDT_BEGIN_NODE)
 			count++;