[PATCH] UBIFS:adjust the procedure in ubifs_new_inode when there is oom occured

liu.song11 at zte.com.cn liu.song11 at zte.com.cn
Thu Dec 4 01:11:28 PST 2014


hi,
In ubifs_new_inode, if failed to get a new inode then will return ERR_PTR.
Maybe adjust the code sequence would make sense.

Signed-off-by: Liu Song <liu.song11 at zte.com.cn>
--------------------------------------------------------------
diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c
index de8fc9b..6dafe23 100644
--- a/fs/ubifs/dir.c
+++ b/fs/ubifs/dir.c
@@ -92,10 +92,9 @@ struct inode *ubifs_new_inode(struct ubifs_info *c, const struct inode *dir,
 	struct ubifs_inode *ui;

 	inode = new_inode(c->vfs_sb);
-	ui = ubifs_inode(inode);
 	if (!inode)
 		return ERR_PTR(-ENOMEM);
-
+	ui = ubifs_inode(inode);
 	/*
 	 * Set 'S_NOCMTIME' to prevent VFS form updating [mc]time of inodes and
 	 * marking them dirty in file write path (see 'file_update_time()').

--------------------------------------------------------
ZTE Information Security Notice: The information contained in this mail (and any attachment transmitted herewith) is privileged and confidential and is intended for the exclusive use of the addressee(s).  If you are not an intended recipient, any disclosure, reproduction, distribution or other dissemination or use of the information contained is strictly prohibited.  If you have received this mail in error, please delete it and notify us immediately.



More information about the linux-mtd mailing list