mbox series

[00/14] gcc-7 warnings

Message ID 20170714092540.1217397-1-arnd@arndb.de
Headers show
Series gcc-7 warnings | expand

Message

Arnd Bergmann July 14, 2017, 9:25 a.m. UTC
This series should shut up all warnings introduced by gcc-6 or gcc-7 on
today's linux-next, as observed in "allmodconfig" builds on x86,
arm and arm64.

I have sent some of these before, but some others are new, as I had
at some point disabled the -Wint-in-bool-context warning in my
randconfig testing and did not notice the other warnings.

I have another series to address all -Wformat-overflow warnings,
and one more patch to turn off the -Wformat-truncation warnings
unless we build with "make W=1". I'll send that separately.

Most of these are consist of trivial refactoring of the code to
shut up false-positive warnings, the one exception being
"staging:iio:resolver:ad2s1210 fix negative IIO_ANGL_VEL read",
which fixes a regression against linux-3.1 that has gone
unnoticed since then. Still, review from subsystem maintainers
would be appreciated.

I would suggest that Andrew Morton can pick these up into linux-mm
so we can make sure they all make it into the release. Alternatively
Linus might feel like picking them all up himself.

While I did not mark the harmless ones for stable backports,
Greg may also want to pick them up once they go upstream, to
help build-test the stable kernels with gcc-7.

      Arnd

Arnd Bergmann (14):
  [SUBMITTED 20170511] ide: avoid warning for timings calculation
  [SUBMITTED 20170511] ata: avoid gcc-7 warning in ata_timing_quantize
  [SUBMITTED 20170314] drm/vmwgfx: avoid gcc-7 parentheses warning
  x86: math-emu: avoid -Wint-in-bool-context warning
  isdn: isdnloop: suppress a gcc-7 warning
  acpi: thermal: fix gcc-6/ccache warning
  proc/kcore: hide a harmless warning
  Input: adxl34x - fix gcc-7 -Wint-in-bool-context warning
  SFI: fix tautological-compare warning
  staging:iio:resolver:ad2s1210 fix negative IIO_ANGL_VEL read
  IB/uverbs: fix gcc-7 type warning
  drm/nouveau/clk: fix gcc-7 -Wint-in-bool-context warning
  iopoll: avoid -Wint-in-bool-context warning
  [media] fix warning on v4l2_subdev_call() result interpreted as bool

 arch/x86/math-emu/fpu_emu.h                          |  2 +-
 drivers/acpi/processor_thermal.c                     |  6 ++++--
 drivers/ata/libata-core.c                            | 20 ++++++++++----------
 drivers/gpu/drm/nouveau/nvkm/subdev/clk/gt215.c      |  6 +++---
 drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c              |  2 +-
 drivers/ide/ide-timings.c                            | 18 +++++++++---------
 drivers/infiniband/core/uverbs.h                     | 14 ++++++++------
 drivers/input/misc/adxl34x.c                         |  2 +-
 drivers/isdn/isdnloop/isdnloop.c                     |  2 +-
 drivers/media/pci/cx18/cx18-ioctl.c                  |  6 ++++--
 drivers/media/pci/saa7146/mxb.c                      |  5 +++--
 drivers/media/platform/atmel/atmel-isc.c             |  4 ++--
 drivers/media/platform/atmel/atmel-isi.c             |  4 ++--
 drivers/media/platform/blackfin/bfin_capture.c       |  4 ++--
 drivers/media/platform/omap3isp/ispccdc.c            |  5 +++--
 drivers/media/platform/pxa_camera.c                  |  3 ++-
 drivers/media/platform/rcar-vin/rcar-core.c          |  2 +-
 drivers/media/platform/rcar-vin/rcar-dma.c           |  4 +++-
 drivers/media/platform/soc_camera/soc_camera.c       |  4 ++--
 drivers/media/platform/stm32/stm32-dcmi.c            |  4 ++--
 drivers/media/platform/ti-vpe/cal.c                  |  6 ++++--
 drivers/sfi/sfi_core.c                               |  9 ++++++---
 drivers/staging/iio/resolver/ad2s1210.c              |  2 +-
 .../staging/media/atomisp/pci/atomisp2/atomisp_cmd.c | 13 +++++++------
 fs/proc/kcore.c                                      | 10 ++++++----
 include/linux/iopoll.h                               |  6 ++++--
 include/linux/regmap.h                               |  2 +-
 27 files changed, 93 insertions(+), 72 deletions(-)

Comments

Joe Perches July 14, 2017, 9:55 a.m. UTC | #1
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...
Greg Kroah-Hartman July 14, 2017, 10:29 a.m. UTC | #2
On Fri, Jul 14, 2017 at 11:25:12AM +0200, Arnd Bergmann wrote:
> This series should shut up all warnings introduced by gcc-6 or gcc-7 on
> today's linux-next, as observed in "allmodconfig" builds on x86,
> arm and arm64.
> 
> I have sent some of these before, but some others are new, as I had
> at some point disabled the -Wint-in-bool-context warning in my
> randconfig testing and did not notice the other warnings.
> 
> I have another series to address all -Wformat-overflow warnings,
> and one more patch to turn off the -Wformat-truncation warnings
> unless we build with "make W=1". I'll send that separately.
> 
> Most of these are consist of trivial refactoring of the code to
> shut up false-positive warnings, the one exception being
> "staging:iio:resolver:ad2s1210 fix negative IIO_ANGL_VEL read",
> which fixes a regression against linux-3.1 that has gone
> unnoticed since then. Still, review from subsystem maintainers
> would be appreciated.
> 
> I would suggest that Andrew Morton can pick these up into linux-mm
> so we can make sure they all make it into the release. Alternatively
> Linus might feel like picking them all up himself.
> 
> While I did not mark the harmless ones for stable backports,
> Greg may also want to pick them up once they go upstream, to
> help build-test the stable kernels with gcc-7.

Thanks for these, I'll keep an eye out for them to get into the stable
trees, so I can eventually update my test-build box to gcc-7.

thanks,

greg k-h