]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
ASoC: mchp-spdiftx: Fix clang -Wbitfield-constant-conversion
authorNathan Chancellor <nathan@kernel.org>
Wed, 10 Aug 2022 01:08:09 +0000 (18:08 -0700)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 23 Nov 2022 14:11:16 +0000 (15:11 +0100)
commit58d2aebe7713d85bf005cf1c81ef897e427fe14d
tree87e5d903fc2a589b60bdf7282e1cd4c10aa15a7b
parenteb6cdb73f9b1e6f93335506dd342589ec51ccba6
ASoC: mchp-spdiftx: Fix clang -Wbitfield-constant-conversion

BugLink: https://bugs.launchpad.net/bugs/1993003
commit 5c5c2baad2b55cc0a4b190266889959642298f79 upstream.

A recent change in clang strengthened its -Wbitfield-constant-conversion
to warn when 1 is assigned to a 1-bit signed integer bitfield, as it can
only be 0 or -1, not 1:

  sound/soc/atmel/mchp-spdiftx.c:505:20: error: implicit truncation from 'int' to bit-field changes value from 1 to -1 [-Werror,-Wbitfield-constant-conversion]
          dev->gclk_enabled = 1;
                            ^ ~
  1 error generated.

The actual value of the field is never checked, just that it is not
zero, so there is not a real bug here. However, it is simple enough to
silence the warning by making the bitfield unsigned, which matches the
mchp-spdifrx driver.

Fixes: 06ca24e98e6b ("ASoC: mchp-spdiftx: add driver for S/PDIF TX Controller")
Link: https://github.com/ClangBuiltLinux/linux/issues/1686
Link: https://github.com/llvm/llvm-project/commit/82afc9b169a67e8b8a1862fb9c41a2cd974d6691
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Link: https://lore.kernel.org/r/20220810010809.2024482-1-nathan@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
sound/soc/atmel/mchp-spdiftx.c