2019-01-25 15:09:55

by Liu Xiang

[permalink] [raw]
Subject: [PATCH] ext2: Remove redundant check for finding no group

When best_desc keeps NULL, best_group keeps -1, too. So we can
return best_group directly.

Signed-off-by: Liu Xiang <[email protected]>
---
fs/ext2/ialloc.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c
index 5c3d7b7..a0c5ea9 100644
--- a/fs/ext2/ialloc.c
+++ b/fs/ext2/ialloc.c
@@ -222,8 +222,6 @@ static int find_group_dir(struct super_block *sb, struct inode *parent)
best_desc = desc;
}
}
- if (!best_desc)
- return -1;

return best_group;
}
--
1.9.1



2019-01-28 14:51:34

by Jan Kara

[permalink] [raw]
Subject: Re: [PATCH] ext2: Remove redundant check for finding no group

On Fri 25-01-19 22:01:36, Liu Xiang wrote:
> When best_desc keeps NULL, best_group keeps -1, too. So we can
> return best_group directly.
>
> Signed-off-by: Liu Xiang <[email protected]>

Thanks for the patch! I've added it to my tree.

Honza

> ---
> fs/ext2/ialloc.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c
> index 5c3d7b7..a0c5ea9 100644
> --- a/fs/ext2/ialloc.c
> +++ b/fs/ext2/ialloc.c
> @@ -222,8 +222,6 @@ static int find_group_dir(struct super_block *sb, struct inode *parent)
> best_desc = desc;
> }
> }
> - if (!best_desc)
> - return -1;
>
> return best_group;
> }
> --
> 1.9.1
>
>
--
Jan Kara <[email protected]>
SUSE Labs, CR