jffs2: refactor csize usage in jffs2_do_read_inode_internal()

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Mon May 28 07:59:06 EDT 2012


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=b6778fd7812d877abdbc78b9b2d4304150b2ce05
Commit:     b6778fd7812d877abdbc78b9b2d4304150b2ce05
Parent:     7c80c352331a27cf0584f1701ed3a003984985f0
Author:     Xi Wang <xi.wang at gmail.com>
AuthorDate: Wed Apr 25 14:45:23 2012 -0400
Committer:  David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Sun May 13 23:08:57 2012 -0500

    jffs2: refactor csize usage in jffs2_do_read_inode_internal()
    
    Replace the verbose `je32_to_cpu(latest_node->csize)' with a shorter
    `csize'.
    
    Signed-off-by: Xi Wang <xi.wang at gmail.com>
    Cc: Artem Bityutskiy <dedekind1 at gmail.com>
    Signed-off-by: Artem Bityutskiy <artem.bityutskiy at linux.intel.com>
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 fs/jffs2/readinode.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c
index 9897f38..3833d74 100644
--- a/fs/jffs2/readinode.c
+++ b/fs/jffs2/readinode.c
@@ -1272,19 +1272,19 @@ static int jffs2_do_read_inode_internal(struct jffs2_sb_info *c,
 				jffs2_do_clear_inode(c, f);
 				return -ENAMETOOLONG;
 			}
-			f->target = kmalloc(je32_to_cpu(latest_node->csize) + 1, GFP_KERNEL);
+			f->target = kmalloc(csize + 1, GFP_KERNEL);
 			if (!f->target) {
-				JFFS2_ERROR("can't allocate %d bytes of memory for the symlink target path cache\n", je32_to_cpu(latest_node->csize));
+				JFFS2_ERROR("can't allocate %u bytes of memory for the symlink target path cache\n", csize);
 				mutex_unlock(&f->sem);
 				jffs2_do_clear_inode(c, f);
 				return -ENOMEM;
 			}
 
 			ret = jffs2_flash_read(c, ref_offset(rii.latest_ref) + sizeof(*latest_node),
-						je32_to_cpu(latest_node->csize), &retlen, (char *)f->target);
+					       csize, &retlen, (char *)f->target);
 
-			if (ret  || retlen != je32_to_cpu(latest_node->csize)) {
-				if (retlen != je32_to_cpu(latest_node->csize))
+			if (ret || retlen != csize) {
+				if (retlen != csize)
 					ret = -EIO;
 				kfree(f->target);
 				f->target = NULL;
@@ -1293,7 +1293,7 @@ static int jffs2_do_read_inode_internal(struct jffs2_sb_info *c,
 				return ret;
 			}
 
-			f->target[je32_to_cpu(latest_node->csize)] = '\0';
+			f->target[csize] = '\0';
 			dbg_readinode("symlink's target '%s' cached\n", f->target);
 		}
 



More information about the linux-mtd-cvs mailing list