From 4a29a1262a47acd8e81a3824492a5aa8f8c5fc95 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Wed, 14 Dec 2022 12:57:27 -0500 Subject: minix: make minix_new_inode() return error as ERR_PTR(-E...) adjust the callers Signed-off-by: Al Viro --- fs/minix/bitmap.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'fs/minix/bitmap.c') diff --git a/fs/minix/bitmap.c b/fs/minix/bitmap.c index 9115948c624e..af50d8e9cd89 100644 --- a/fs/minix/bitmap.c +++ b/fs/minix/bitmap.c @@ -210,7 +210,7 @@ void minix_free_inode(struct inode * inode) mark_buffer_dirty(bh); } -struct inode *minix_new_inode(const struct inode *dir, umode_t mode, int *error) +struct inode *minix_new_inode(const struct inode *dir, umode_t mode) { struct super_block *sb = dir->i_sb; struct minix_sb_info *sbi = minix_sb(sb); @@ -220,13 +220,10 @@ struct inode *minix_new_inode(const struct inode *dir, umode_t mode, int *error) unsigned long j; int i; - if (!inode) { - *error = -ENOMEM; - return NULL; - } + if (!inode) + return ERR_PTR(-ENOMEM); j = bits_per_zone; bh = NULL; - *error = -ENOSPC; spin_lock(&bitmap_lock); for (i = 0; i < sbi->s_imap_blocks; i++) { bh = sbi->s_imap[i]; @@ -237,20 +234,20 @@ struct inode *minix_new_inode(const struct inode *dir, umode_t mode, int *error) if (!bh || j >= bits_per_zone) { spin_unlock(&bitmap_lock); iput(inode); - return NULL; + return ERR_PTR(-ENOSPC); } if (minix_test_and_set_bit(j, bh->b_data)) { /* shouldn't happen */ spin_unlock(&bitmap_lock); printk("minix_new_inode: bit already set\n"); iput(inode); - return NULL; + return ERR_PTR(-ENOSPC); } spin_unlock(&bitmap_lock); mark_buffer_dirty(bh); j += i * bits_per_zone; if (!j || j > sbi->s_ninodes) { iput(inode); - return NULL; + return ERR_PTR(-ENOSPC); } inode_init_owner(&init_user_ns, inode, dir, mode); inode->i_ino = j; @@ -260,7 +257,6 @@ struct inode *minix_new_inode(const struct inode *dir, umode_t mode, int *error) insert_inode_hash(inode); mark_inode_dirty(inode); - *error = 0; return inode; } -- cgit v1.2.3