summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@armlinux.org.uk>2019-12-09 11:10:06 +0000
committerAl Viro <viro@zeniv.linux.org.uk>2020-01-20 20:12:41 -0500
commit4a0a88b6660b48f773b6e7631e0be57b7f5048ed (patch)
treee67920a71d2369ac672fcbf8fcd6981bc4689d8f
parentf6075c79074378910e131bbebc9d1dab53fd9986 (diff)
fs/adfs: dir: improve compiler coverage in adfs_dir_update
Get rid of the ifdef, using IS_ENABLED() instead to detect whether the code should be callable. This allows the compiler to always parse the following code, reducing the chances of errors being missed. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--fs/adfs/dir.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/adfs/dir.c b/fs/adfs/dir.c
index 5e5d344bae7c..931eefb2375b 100644
--- a/fs/adfs/dir.c
+++ b/fs/adfs/dir.c
@@ -287,14 +287,16 @@ unlock:
int
adfs_dir_update(struct super_block *sb, struct object_info *obj, int wait)
{
- int ret = -EINVAL;
-#ifdef CONFIG_ADFS_FS_RW
const struct adfs_dir_ops *ops = ADFS_SB(sb)->s_dir;
struct adfs_dir dir;
+ int ret;
printk(KERN_INFO "adfs_dir_update: object %06x in dir %06x\n",
obj->indaddr, obj->parent_id);
+ if (!IS_ENABLED(CONFIG_ADFS_FS_RW))
+ return -EINVAL;
+
if (!ops->update)
return -EINVAL;
@@ -328,7 +330,7 @@ forget:
adfs_dir_forget(&dir);
unlock:
up_write(&adfs_dir_rwsem);
-#endif
+
return ret;
}