Skip to content

Commit 4a0a88b

Browse files
Russell KingAl Viro
authored andcommitted
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 <[email protected]> Signed-off-by: Al Viro <[email protected]>
1 parent f6075c7 commit 4a0a88b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

fs/adfs/dir.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,14 +287,16 @@ adfs_readdir(struct file *file, struct dir_context *ctx)
287287
int
288288
adfs_dir_update(struct super_block *sb, struct object_info *obj, int wait)
289289
{
290-
int ret = -EINVAL;
291-
#ifdef CONFIG_ADFS_FS_RW
292290
const struct adfs_dir_ops *ops = ADFS_SB(sb)->s_dir;
293291
struct adfs_dir dir;
292+
int ret;
294293

295294
printk(KERN_INFO "adfs_dir_update: object %06x in dir %06x\n",
296295
obj->indaddr, obj->parent_id);
297296

297+
if (!IS_ENABLED(CONFIG_ADFS_FS_RW))
298+
return -EINVAL;
299+
298300
if (!ops->update)
299301
return -EINVAL;
300302

@@ -328,7 +330,7 @@ adfs_dir_update(struct super_block *sb, struct object_info *obj, int wait)
328330
adfs_dir_forget(&dir);
329331
unlock:
330332
up_write(&adfs_dir_rwsem);
331-
#endif
333+
332334
return ret;
333335
}
334336

0 commit comments

Comments
 (0)