Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753727AbdGNKJE (ORCPT ); Fri, 14 Jul 2017 06:09:04 -0400 Received: from smtprelay0175.hostedemail.com ([216.40.44.175]:45760 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753422AbdGNKJB (ORCPT ); Fri, 14 Jul 2017 06:09:01 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::::::::::,RULES_HIT:41:355:379:541:599: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:2559:2562:2693:2828:3138:3139:3140:3141:3142:3352:3622:3865:3866:3867:3868:3870:3871:3872:4321:4384:5007:6119:7903:10004:10400:10848:11026:11232:11473:11658:11783:11914:12043:12048:12296:12438:12740:12895:13069:13161:13229:13311:13357:13439:13894:14659:14721:21080:21433:21451:21627:30009:30054: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:1,LUA_SUMMARY:none X-HE-Tag: rain71_886dbcf80285d X-Filterd-Recvd-Size: 2523 Message-ID: <1500026936.4457.68.camel@perches.com> Subject: Re: [PATCH 05/14] isdn: isdnloop: suppress a gcc-7 warning From: Joe Perches To: Arnd Bergmann , linux-kernel@vger.kernel.org, Karsten Keil , "David S. Miller" Cc: Greg Kroah-Hartman , Linus Torvalds , Tejun Heo , Guenter Roeck , linux-ide@vger.kernel.org, linux-media@vger.kernel.org, akpm@linux-foundation.org, dri-devel@lists.freedesktop.org, netdev@vger.kernel.org Date: Fri, 14 Jul 2017 03:08:56 -0700 In-Reply-To: <20170714092540.1217397-6-arnd@arndb.de> References: <20170714092540.1217397-1-arnd@arndb.de> <20170714092540.1217397-6-arnd@arndb.de> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.22.6-1ubuntu1 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1360 Lines: 30 On Fri, 2017-07-14 at 11:25 +0200, Arnd Bergmann wrote: > We test whether a bit is set in a mask here, which is correct > but gcc warns about it as it thinks it might be confusing: > > drivers/isdn/isdnloop/isdnloop.c:412:37: error: ?: using integer constants in boolean context, the expression will always evaluate to 'true' [-Werror=int-in-bool-context] > > This replaces the negation of an integer with an equivalent > comparison to zero, which gets rid of the warning. [] > diff --git a/drivers/isdn/isdnloop/isdnloop.c b/drivers/isdn/isdnloop/isdnloop.c [] > @@ -409,7 +409,7 @@ isdnloop_sendbuf(int channel, struct sk_buff *skb, isdnloop_card *card) > return -EINVAL; > } > if (len) { > - if (!(card->flags & (channel) ? ISDNLOOP_FLAGS_B2ACTIVE : ISDNLOOP_FLAGS_B1ACTIVE)) > + if ((card->flags & (channel) ? ISDNLOOP_FLAGS_B2ACTIVE : ISDNLOOP_FLAGS_B1ACTIVE) == 0) > return 0; > if (card->sndcount[channel] > ISDNLOOP_MAX_SQUEUE) > return 0; The if as written can not be zero. drivers/isdn/isdnloop/isdnloop.h:#define ISDNLOOP_FLAGS_B1ACTIVE 1??????/* B-Channel-1 is open???????????*/ drivers/isdn/isdnloop/isdnloop.h:#define ISDNLOOP_FLAGS_B2ACTIVE 2??????/* B-Channel-2 is open???????????*/ Perhaps this is a logic defect and should be: if (!(card->flags & ((channel) ? ISDNLOOP_FLAGS_B2ACTIVE : ISDNLOOP_FLAGS_B1ACTIVE)))