[PATCH v1 1/5] bitfield: Silence a clang -Wshorten-64-to-32 warning

Ian Rogers
2025-04-03T16:57:10Z

include/linux/bitfield.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/bitfield.h b/include/linux/bitfield.h
index 63928f173223..cc5cfed041bb 100644
--- a/include/linux/bitfield.h
+++ b/include/linux/bitfield.h
@@ -176,7 +176,7 @@ static __always_inline __##type type##_encode_bits(base v, base field) \
{ \
if (__builtin_constant_p(v) && (v & ~field_mask(field))) \
__field_overflow(); \
- return to((v & field_mask(field)) * field_multiplier(field)); \
+ return to((__##type)((v & field_mask(field)) * field_multiplier(field))); \
} \
static __always_inline __##type type##_replace_bits(__##type old, \
base val, base field) \
--
2.49.0.504.g3bcea36a83-goog