[PATCH] jffs,clang: avoid some warnings of used uninitialized ptr

Daniel Hellstrom daniel at gaisler.com
Fri Oct 5 06:57:52 UTC 2018


This fixes the following test failures on LEON3 UP/SMP when
built using clang compiler:
 * fsjffs2gc01
 * jffs2_fserror
 * jffs2_fspermission
 * jffs2_fsrdwr
 * jffs2_fstime
---
 cpukit/libfs/src/jffs2/src/nodelist.c  | 2 +-
 cpukit/libfs/src/jffs2/src/readinode.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/cpukit/libfs/src/jffs2/src/nodelist.c b/cpukit/libfs/src/jffs2/src/nodelist.c
index ee44024..a633e0a 100644
--- a/cpukit/libfs/src/jffs2/src/nodelist.c
+++ b/cpukit/libfs/src/jffs2/src/nodelist.c
@@ -566,7 +566,7 @@ struct jffs2_node_frag *jffs2_lookup_node_frag(struct rb_root *fragtree, uint32_
    they're killed. */
 void jffs2_kill_fragtree(struct rb_root *root, struct jffs2_sb_info *c)
 {
-	struct jffs2_node_frag *frag, *next;
+	struct jffs2_node_frag *frag = NULL, *next;
 
 	dbg_fragtree("killing\n");
 	rbtree_postorder_for_each_entry_safe(frag, next, root, rb) {
diff --git a/cpukit/libfs/src/jffs2/src/readinode.c b/cpukit/libfs/src/jffs2/src/readinode.c
index 519b0d6..d37f46a 100644
--- a/cpukit/libfs/src/jffs2/src/readinode.c
+++ b/cpukit/libfs/src/jffs2/src/readinode.c
@@ -35,7 +35,7 @@ static int check_node_data(struct jffs2_sb_info *c, struct jffs2_tmp_dnode_info
 	struct jffs2_raw_node_ref *ref = tn->fn->raw;
 	int err = 0, pointed = 0;
 	struct jffs2_eraseblock *jeb;
-	unsigned char *buffer;
+	unsigned char *buffer = NULL;
 	uint32_t crc, ofs, len;
 	size_t retlen;
 
@@ -552,7 +552,7 @@ static int jffs2_build_inode_fragtree(struct jffs2_sb_info *c,
 
 static void jffs2_free_tmp_dnode_info_list(struct rb_root *list)
 {
-	struct jffs2_tmp_dnode_info *tn, *next;
+	struct jffs2_tmp_dnode_info *tn = NULL, *next;
 
 	rbtree_postorder_for_each_entry_safe(tn, next, list, rb) {
 			jffs2_free_full_dnode(tn->fn);
-- 
2.7.4




More information about the devel mailing list