Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751429AbbECSQA (ORCPT ); Sun, 3 May 2015 14:16:00 -0400 Received: from mailsec119.isp.belgacom.be ([195.238.20.115]:12220 "EHLO mailsec119.isp.belgacom.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750989AbbECSPw convert rfc822-to-8bit (ORCPT ); Sun, 3 May 2015 14:15:52 -0400 X-Cloudmark-SP-Filtered: true X-Cloudmark-SP-Result: v=1.1 cv=wisUSL2q+2X910teRg2xg/30tBFW7lBMAi45pEFXNHU= c=1 sm=2 a=IkcTkHD0fZMA:10 a=pGLkceISAAAA:8 a=Z4Rwk6OoAAAA:8 a=MrCIyztw3-3FSMq2LTIA:9 a=QEXdDO2ut3YA:10 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2AcCwD0ZEZV/9EU7sNcgwyBL4MdsGgBAQEBAQEGmUkCgT48EAEBAQEBAQGBCkEFg1oBAQEDASMEUgULBQQCGAICGA4CAiE2BhMRiAYDCQyVBp0HhlGGcg2FHgEBAQEGAgEfgSGEdoUigk2CBTMHgmiBRQWRZ4kjgnmGRIdWgw6DUiNggQWCETwxgkUBAQE Date: Sun, 3 May 2015 20:15:50 +0200 (CEST) From: Fabian Frederick Reply-To: Fabian Frederick To: Richard Weinberger Cc: Andrew Morton , LKML , linux-fsdevel Message-ID: <1190129389.190434.1430676950131.open-xchange@webmail.nmp.proximus.be> In-Reply-To: References: <1430592980-28856-1-git-send-email-fabf@skynet.be> Subject: Re: [PATCH 1/1 linux-next] affs: add default case in switch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-Priority: 3 Importance: Medium X-Mailer: Open-Xchange Mailer v7.2.2-Rev27 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2345 Lines: 68 > On 03 May 2015 at 16:51 Richard Weinberger > wrote: > > > On Sat, May 2, 2015 at 8:56 PM, Fabian Frederick wrote: > > Fix gcc -Wswitch-default warnings > > > > Cc: Andrew Morton > > Signed-off-by: Fabian Frederick > > --- > >  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. As far as I understand, switch in affs_lookup() only updates inode number when it's a link so we can simply add default:break to silence gcc warning or replace by if(). affs_iget() switch on the other hand applies to any type of file. Maybe we could add default: BUG() to avoid working on bad inode ? Regards, Fabian > > -- > Thanks, > //richard -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/