lkml.org 
[lkml]   [2015]   [May]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 1/1 linux-next] affs: add default case in switch
From
On Sat, May 2, 2015 at 8:56 PM, Fabian Frederick <fabf@skynet.be> wrote:
> Fix gcc -Wswitch-default warnings
>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Signed-off-by: Fabian Frederick <fabf@skynet.be>
> ---
> fs/affs/inode.c | 2 ++
> fs/affs/namei.c | 3 +++
> 2 files changed, 5 insertions(+)
>
> diff --git a/fs/affs/inode.c b/fs/affs/inode.c
> index 1734950..623398e 100644
> --- a/fs/affs/inode.c
> +++ b/fs/affs/inode.c
> @@ -143,6 +143,8 @@ struct inode *affs_iget(struct super_block *sb, unsigned long ino)
> inode->i_op = &affs_symlink_inode_operations;
> inode->i_data.a_ops = &affs_symlink_aops;
> break;
> + default:
> + break;
> }
>
> inode->i_mtime.tv_sec = inode->i_atime.tv_sec = inode->i_ctime.tv_sec
> diff --git a/fs/affs/namei.c b/fs/affs/namei.c
> index 181e05b..517926d 100644
> --- a/fs/affs/namei.c
> +++ b/fs/affs/namei.c
> @@ -237,6 +237,9 @@ affs_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags)
> //case ST_LINKDIR:
> case ST_LINKFILE:
> ino = be32_to_cpu(AFFS_TAIL(sb, bh)->original);
> + break;
> + default:
> + break;

How can this code path be reached?
If I read your patch correctly it just silences gcc.

If the code can be reached you need to take a proper action of not the
warning is bogus.

--
Thanks,
//richard


\
 
 \ /
  Last update: 2015-05-03 17:21    [W:0.063 / U:0.220 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site