From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756194AbdKCQCk (ORCPT ); Fri, 3 Nov 2017 12:02:40 -0400 Received: from smtprelay0079.hostedemail.com ([216.40.44.79]:40903 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756143AbdKCQCh (ORCPT ); Fri, 3 Nov 2017 12:02:37 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::,RULES_HIT:41:355:379:541:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2553:2559:2562:2828:3138:3139:3140:3141:3142:3353:3622:3865:3867:3868:3870:3871:3872:3874:4250:4321:5007:6119:9038:10004:10400:10848:11232:11658:11914:12296:12555:12740:12760:12895:12986:13069:13311:13357:13439:14096:14097:14180:14181:14659:14721:21060:21067:21080:21324:21433:21451:21627:30012:30041:30054:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:2,LUA_SUMMARY:none X-HE-Tag: tail15_8af08c530e924 X-Filterd-Recvd-Size: 2454 Message-ID: <1509724953.15520.26.camel@perches.com> Subject: Re: [PATCH] watchdog: pcwd_pci: mark expected switch fall-through From: Joe Perches To: Guenter Roeck , Wim Van Sebroeck Cc: "Gustavo A. R. Silva" , linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org Date: Fri, 03 Nov 2017 09:02:33 -0700 In-Reply-To: <20171103155426.GA21990@roeck-us.net> References: <20171103144915.GA6243@embeddedor.com> <20171103150423.GA10138@infomag.iguana.be> <20171103155426.GA21990@roeck-us.net> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.26.1-1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2017-11-03 at 08:54 -0700, Guenter Roeck wrote: > On Fri, Nov 03, 2017 at 04:04:23PM +0100, Wim Van Sebroeck wrote: > > Hi Gustavo, > > > > > In preparation to enabling -Wimplicit-fallthrough, mark switch cases > > > where we are expecting to fall through. > > > > > > Notice that in this particular case I replaced "Fall" with a proper > > > "fall through" comment, which is what GCC is expecting to find. > > > > > > Signed-off-by: Gustavo A. R. Silva > > > --- > > > drivers/watchdog/pcwd_pci.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/drivers/watchdog/pcwd_pci.c b/drivers/watchdog/pcwd_pci.c > > > index c0d07ee..c882252 100644 > > > --- a/drivers/watchdog/pcwd_pci.c > > > +++ b/drivers/watchdog/pcwd_pci.c > > > @@ -545,7 +545,7 @@ static long pcipcwd_ioctl(struct file *file, unsigned int cmd, > > > return -EINVAL; > > > > > > pcipcwd_keepalive(); > > > - /* Fall */ > > > + /* fall through */ > > > } > > > > > > case WDIOC_GETTIMEOUT: > > > -- > > > 2.7.4 > > > > > > > Shouldn't the /* fall through */ come after the } ? > > > > Good question. This is an unconditional code block needed to declare > a local variable within the case statement. What is correct in that > situation ? I think it'd be clearer to avoid the trivial fallthrough optimization/complexity and just directly use return put_user(new_heartbeat, p); as heartbeat and new_heartbeat are now the same value here.