linux/include
Arnd Bergmann d15809f364 iopoll: avoid -Wint-in-bool-context warning
When we pass the result of a multiplication as the timeout or the delay,
we can get a warning from gcc-7:

  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]
  drivers/gpu/drm/sun4i/sun4i_hdmi_i2c.c:49:27: error: '*' in boolean context, suggest '&&' instead [-Werror=int-in-bool-context]

The warning is a bit questionable inside of a macro, but this is
intentional on the side of the gcc developers.  It is also an indication
of another problem: we evaluate the timeout and sleep arguments multiple
times, which can have undesired side-effects when those are complex
expressions.

This changes the two iopoll variants to use local variables for storing
copies of the timeouts.  This adds some more type safety, and avoids
both the double-evaluation and the gcc warning.

Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81484
Link: http://lkml.kernel.org/r/20170726133756.2161367-1-arnd@arndb.de
Link: http://lkml.kernel.org/r/20171102114048.1526955-1-arnd@arndb.de
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-11-17 16:10:01 -08:00
..
acpi TTY/Serial patches for 4.15-rc1 2017-11-13 21:05:31 -08:00
asm-generic kernel debug: support resetting WARN*_ONCE 2017-11-17 16:10:00 -08:00
clocksource arm64 updates for 4.15 2017-11-15 10:56:56 -08:00
crypto Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2017-11-14 10:52:09 -08:00
drm main drm pull request for v4.15 2017-11-15 20:42:10 -08:00
dt-bindings ARM: SoC driver updates for v4.15 2017-11-16 16:05:01 -08:00
keys
kvm KVM: arm/arm64: Rework kvm_timer_should_fire 2017-11-06 16:23:17 +01:00
lib
linux iopoll: avoid -Wint-in-bool-context warning 2017-11-17 16:10:01 -08:00
math-emu
media media updates for v4.15-rc1 2017-11-15 20:30:12 -08:00
memory
misc
net Merge branch 'akpm' (patches from Andrew) 2017-11-15 19:42:40 -08:00
pcmcia
ras
rdma Updates for 4.15 kernel merge window 2017-11-15 14:54:53 -08:00
scsi SCSI misc on 20171114 2017-11-14 16:23:44 -08:00
soc
sound ASoC: Updates for v4.15 2017-11-13 15:45:57 +01:00
target A couple of configfs cleanups: 2017-11-14 14:44:04 -08:00
trace libnvdimm for 4.15 2017-11-17 09:51:57 -08:00
uapi libnvdimm for 4.15 2017-11-17 09:51:57 -08:00
video
xen xen: features and fixes for v4.15-rc1 2017-11-16 13:06:27 -08:00