Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753805AbdGNKWD (ORCPT ); Fri, 14 Jul 2017 06:22:03 -0400 Received: from mail-oi0-f66.google.com ([209.85.218.66]:34861 "EHLO mail-oi0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753557AbdGNKWC (ORCPT ); Fri, 14 Jul 2017 06:22:02 -0400 MIME-Version: 1.0 In-Reply-To: <1500026123.4457.66.camel@perches.com> References: <20170714092540.1217397-1-arnd@arndb.de> <20170714093129.1366900-4-arnd@arndb.de> <1500026123.4457.66.camel@perches.com> From: Arnd Bergmann Date: Fri, 14 Jul 2017 12:22:00 +0200 X-Google-Sender-Auth: A_ojMyptITzg-ADDLIMX6fFHka8 Message-ID: Subject: Re: [PATCH 13/14] iopoll: avoid -Wint-in-bool-context warning To: Joe Perches Cc: Linux Kernel Mailing List , Mark Brown , Andrew Morton , Greg Kroah-Hartman , Linus Torvalds , Tejun Heo , Guenter Roeck , IDE-ML , Linux Media Mailing List , dri-devel , Masahiro Yamada , Charles Keepax Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 871 Lines: 19 On Fri, Jul 14, 2017 at 11:55 AM, Joe Perches wrote: > 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. I thought about that, but decided that as a negative timeout_us already gives us rather random behavior (ktime_add_us() takes an unsigned argument), the '>' comparison gives a more well-defined result by ignoring the timeout. Arnd