Commit eab9100d authored by Nathan Chancellor's avatar Nathan Chancellor Committed by Mark Brown

ASoC: mchp-spdiftx: Fix clang -Wbitfield-constant-conversion

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: 06ca24e9 ("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/82afc9b169a67e8b8a1862fb9c41a2cd974d6691Signed-off-by: default avatarNathan Chancellor <nathan@kernel.org>
Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
Link: https://lore.kernel.org/r/20220810010809.2024482-1-nathan@kernel.orgSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent d5633368
...@@ -196,7 +196,7 @@ struct mchp_spdiftx_dev { ...@@ -196,7 +196,7 @@ struct mchp_spdiftx_dev {
struct clk *pclk; struct clk *pclk;
struct clk *gclk; struct clk *gclk;
unsigned int fmt; unsigned int fmt;
int gclk_enabled:1; unsigned int gclk_enabled:1;
}; };
static inline int mchp_spdiftx_is_running(struct mchp_spdiftx_dev *dev) static inline int mchp_spdiftx_is_running(struct mchp_spdiftx_dev *dev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment