[rtems commit] jffs2: Avoid use of constant register variable

Sebastian Huber sebh at rtems.org
Mon Oct 8 05:16:06 UTC 2018


Module:    rtems
Branch:    master
Commit:    05b5f9c0ea4b3b4b3d6402ae5ba5f765cea9b937
Changeset: http://git.rtems.org/rtems/commit/?id=05b5f9c0ea4b3b4b3d6402ae5ba5f765cea9b937

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Oct  5 13:56:59 2018 +0200

jffs2: Avoid use of constant register variable

Avoid the use of a constant register variable which is used in some
conditions.  This gets rid of a clang -Wsometimes-uninitialized warning.

---

 cpukit/libfs/src/jffs2/src/readinode.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/cpukit/libfs/src/jffs2/src/readinode.c b/cpukit/libfs/src/jffs2/src/readinode.c
index 519b0d6..e6c9452 100644
--- a/cpukit/libfs/src/jffs2/src/readinode.c
+++ b/cpukit/libfs/src/jffs2/src/readinode.c
@@ -33,7 +33,11 @@
 static int check_node_data(struct jffs2_sb_info *c, struct jffs2_tmp_dnode_info *tn)
 {
 	struct jffs2_raw_node_ref *ref = tn->fn->raw;
+#ifndef __rtems__
 	int err = 0, pointed = 0;
+#else /* __rtems__ */
+	int err = 0;
+#endif /* __rtems__ */
 	struct jffs2_eraseblock *jeb;
 	unsigned char *buffer;
 	uint32_t crc, ofs, len;
@@ -77,7 +81,9 @@ static int check_node_data(struct jffs2_sb_info *c, struct jffs2_tmp_dnode_info
 		pointed = 1; /* succefully pointed to device */
 #endif
 
+#ifndef __rtems__
 	if (!pointed) {
+#endif /* __rtems__ */
 		buffer = kmalloc(len, GFP_KERNEL);
 		if (unlikely(!buffer))
 			return -ENOMEM;
@@ -95,11 +101,15 @@ static int check_node_data(struct jffs2_sb_info *c, struct jffs2_tmp_dnode_info
 			err = -EIO;
 			goto free_out;
 		}
+#ifndef __rtems__
 	}
+#endif /* __rtems__ */
 
 	/* Continue calculating CRC */
 	crc = crc32(tn->partial_crc, buffer, len);
+#ifndef __rtems__
 	if(!pointed)
+#endif /* __rtems__ */
 		kfree(buffer);
 #ifndef __ECOS
 	else
@@ -135,7 +145,9 @@ adj_acc:
 	return 0;
 
 free_out:
+#ifndef __rtems__
 	if(!pointed)
+#endif /* __rtems__ */
 		kfree(buffer);
 #ifndef __ECOS
 	else




More information about the vc mailing list