Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753678AbdGNJz3 (ORCPT ); Fri, 14 Jul 2017 05:55:29 -0400 Received: from smtprelay0162.hostedemail.com ([216.40.44.162]:47432 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753557AbdGNJz2 (ORCPT ); Fri, 14 Jul 2017 05:55:28 -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:1540:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:2828:3138:3139:3140:3141:3142:3352:3622:3865:3866:3867:3870:3871:3872:4321:5007:7903:10004:10400:10848:11232:11658:11914:12043:12048:12109:12114:12740:12760:12895:13069:13311:13357:13439:14659:14721:21080:21433:21627:30036: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: meal64_122b1effa4152 X-Filterd-Recvd-Size: 2116 Message-ID: <1500026123.4457.66.camel@perches.com> Subject: Re: [PATCH 13/14] iopoll: avoid -Wint-in-bool-context warning From: Joe Perches To: Arnd Bergmann , linux-kernel@vger.kernel.org, Mark Brown , Andrew Morton Cc: Greg Kroah-Hartman , Linus Torvalds , Tejun Heo , Guenter Roeck , linux-ide@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, Masahiro Yamada , Charles Keepax Date: Fri, 14 Jul 2017 02:55:23 -0700 In-Reply-To: <20170714093129.1366900-4-arnd@arndb.de> References: <20170714092540.1217397-1-arnd@arndb.de> <20170714093129.1366900-4-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: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 902 Lines: 26 On Fri, 2017-07-14 at 11:31 +0200, Arnd Bergmann wrote: > When we pass the result of a multiplication as the timeout, we > can get a warning: > > drivers/mmc/host/bcm2835.c:596:149: error: '*' in boolean context, suggest '&&' instead [-Werror=int-in-bool-context] > drivers/mfd/arizona-core.c:247:195: error: '*' in boolean context, suggest '&&' instead [-Werror=int-in-bool-context] > > This is easy to avoid by comparing the timeout to zero instead, > making it a boolean expression. Perhaps this is better as != 0 if the multiply is signed. > diff --git a/include/linux/iopoll.h b/include/linux/iopoll.h [] > @@ -48,7 +48,8 @@ > (val) = op(addr); \ > if (cond) \ > break; \ > - if (timeout_us && ktime_compare(ktime_get(), timeout) > 0) { \ > + if ((timeout_us) > 0 && \ > + ktime_compare(ktime_get(), timeout) > 0) { \ > (val) = op(addr); \ > break; \ > } \ etc...