lkml.org 
[lkml]   [2017]   [May]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] ide: avoid warning for timings calculation
On Thu, May 11, 2017 at 3:52 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> gcc-7 warns about the result of a constant multiplication used as
> a boolean:
>
> drivers/ide/ide-timings.c: In function 'ide_timing_quantize':
> drivers/ide/ide-timings.c:112:24: error: '*' in boolean context, suggest '&&' instead [-Werror=int-in-bool-context]
> q->setup = EZ(t->setup * 1000, T);
>
> This slightly rearranges the macro to simplify the code and avoid
> the warning at the same time.

> #define ENOUGH(v, unit) (((v) - 1) / (unit) + 1)
> -#define EZ(v, unit) ((v) ? ENOUGH(v, unit) : 0)
> +#define EZ(v, unit) ((v) ? ENOUGH(v * 1000, unit) : 0)

Perhaps
v -> (v) in the multiplication.

--
With Best Regards,
Andy Shevchenko

\
 
 \ /
  Last update: 2017-05-27 22:24    [W:0.044 / U:0.620 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site