Skip to content

Commit 5c5c2ba

Browse files
nathanchancebroonie
authored andcommitted
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: 06ca24e ("ASoC: mchp-spdiftx: add driver for S/PDIF TX Controller") Link: ClangBuiltLinux#1686 Link: llvm/llvm-project@82afc9b Signed-off-by: Nathan Chancellor <[email protected]> Reviewed-by: Nick Desaulniers <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 1faa6f8 commit 5c5c2ba

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sound/soc/atmel/mchp-spdiftx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ struct mchp_spdiftx_dev {
196196
struct clk *pclk;
197197
struct clk *gclk;
198198
unsigned int fmt;
199-
int gclk_enabled:1;
199+
unsigned int gclk_enabled:1;
200200
};
201201

202202
static inline int mchp_spdiftx_is_running(struct mchp_spdiftx_dev *dev)

0 commit comments

Comments
 (0)