2019-01-24 18:05:33

by Mathieu Malaterre

[permalink] [raw]
Subject: [PATCH] ext2: Annotate implicit fall through in __ext2_truncate_blocks

There is a plan to build the kernel with -Wimplicit-fallthrough and
these places in the code produced warnings (W=1).

This commit removes the following warnings:

fs/ext2/inode.c:1237:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
fs/ext2/inode.c:1244:7: warning: this statement may fall through [-Wimplicit-fallthrough=]

Signed-off-by: Mathieu Malaterre <[email protected]>
---
fs/ext2/inode.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
index e4bb9386c045..e64029b1bd50 100644
--- a/fs/ext2/inode.c
+++ b/fs/ext2/inode.c
@@ -1239,6 +1239,7 @@ static void __ext2_truncate_blocks(struct inode *inode, loff_t offset)
mark_inode_dirty(inode);
ext2_free_branches(inode, &nr, &nr+1, 1);
}
+ /* fall through */
case EXT2_IND_BLOCK:
nr = i_data[EXT2_DIND_BLOCK];
if (nr) {
@@ -1246,6 +1247,7 @@ static void __ext2_truncate_blocks(struct inode *inode, loff_t offset)
mark_inode_dirty(inode);
ext2_free_branches(inode, &nr, &nr+1, 2);
}
+ /* fall through */
case EXT2_DIND_BLOCK:
nr = i_data[EXT2_TIND_BLOCK];
if (nr) {
--
2.19.2



2019-01-28 14:51:12

by Jan Kara

[permalink] [raw]
Subject: Re: [PATCH] ext2: Annotate implicit fall through in __ext2_truncate_blocks

On Thu 24-01-19 19:05:04, Mathieu Malaterre wrote:
> There is a plan to build the kernel with -Wimplicit-fallthrough and
> these places in the code produced warnings (W=1).
>
> This commit removes the following warnings:
>
> fs/ext2/inode.c:1237:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
> fs/ext2/inode.c:1244:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
>
> Signed-off-by: Mathieu Malaterre <[email protected]>

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

Honza

> ---
> fs/ext2/inode.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
> index e4bb9386c045..e64029b1bd50 100644
> --- a/fs/ext2/inode.c
> +++ b/fs/ext2/inode.c
> @@ -1239,6 +1239,7 @@ static void __ext2_truncate_blocks(struct inode *inode, loff_t offset)
> mark_inode_dirty(inode);
> ext2_free_branches(inode, &nr, &nr+1, 1);
> }
> + /* fall through */
> case EXT2_IND_BLOCK:
> nr = i_data[EXT2_DIND_BLOCK];
> if (nr) {
> @@ -1246,6 +1247,7 @@ static void __ext2_truncate_blocks(struct inode *inode, loff_t offset)
> mark_inode_dirty(inode);
> ext2_free_branches(inode, &nr, &nr+1, 2);
> }
> + /* fall through */
> case EXT2_DIND_BLOCK:
> nr = i_data[EXT2_TIND_BLOCK];
> if (nr) {
> --
> 2.19.2
>
>
--
Jan Kara <[email protected]>
SUSE Labs, CR