1 ext4: clean up error handling in swap_inode_boot_loader()
3 Tighten up the code to make the code easier to read and maintain.
5 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
7 fs/ext4/ioctl.c | 24 ++++++------------------
8 1 file changed, 6 insertions(+), 18 deletions(-)
10 diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
11 index a2a837f..0f2252e 100644
14 @@ -104,21 +104,15 @@ static long swap_inode_boot_loader(struct super_block *sb,
15 struct ext4_inode_info *ei_bl;
16 struct ext4_sb_info *sbi = EXT4_SB(sb);
18 - if (inode->i_nlink != 1 || !S_ISREG(inode->i_mode)) {
22 + if (inode->i_nlink != 1 || !S_ISREG(inode->i_mode))
25 - if (!inode_owner_or_capable(inode) || !capable(CAP_SYS_ADMIN)) {
29 + if (!inode_owner_or_capable(inode) || !capable(CAP_SYS_ADMIN))
32 inode_bl = ext4_iget(sb, EXT4_BOOT_LOADER_INO);
33 - if (IS_ERR(inode_bl)) {
34 - err = PTR_ERR(inode_bl);
37 + if (IS_ERR(inode_bl))
38 + return PTR_ERR(inode_bl);
39 ei_bl = EXT4_I(inode_bl);
41 filemap_flush(inode->i_mapping);
42 @@ -193,20 +187,14 @@ static long swap_inode_boot_loader(struct super_block *sb,
43 ext4_mark_inode_dirty(handle, inode);
47 ext4_journal_stop(handle);
49 ext4_double_up_write_data_sem(inode, inode_bl);
52 ext4_inode_resume_unlocked_dio(inode);
53 ext4_inode_resume_unlocked_dio(inode_bl);
55 unlock_two_nondirectories(inode, inode_bl);