Re: [PATCH] ide: avoid warning for timings calculation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, May 11, 2017 at 3:52 PM, Arnd Bergmann <arnd@xxxxxxxx> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux