Skip to contentSkip to conversation

alloc_file(): simplify handling of mnt_clone_write() errors

PATCH Roland Dreier 1 participant 1 message Dec 16, 2009 VFS

lore
Share & tools
lore
#0 lore raw

When alloc_file() and init_file() were combined, the error handling of mnt_clone_write() was taken into alloc_file() in a somewhat obfuscated way. Since we don't use the error code for anything except warning, we might as well warn directly without an extra variable.

---
 fs/file_table.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
fs/file_table.c +1 -3
index 17a55b8..25fe294 100644
@@ -186,10 +186,8 @@ struct file *alloc_file(struct path *path, fmode_t mode,
 	 * that we can do debugging checks at __fput()
 	 */
 	if ((mode & FMODE_WRITE) && !special_file(path->dentry->d_inode->i_mode)) {
-		int error = 0;
 		file_take_write(file);
-		error = mnt_clone_write(path->mnt);
-		WARN_ON(error);
+		WARN_ON(mnt_clone_write(path->mnt));
 	}
 	ima_counts_get(file);
 	return file;