[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200916150333.11790-1-srinivas.kandagatla@linaro.org>
Date: Wed, 16 Sep 2020 16:03:33 +0100
From: Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
To: davem@...emloft.net, gregkh@...uxfoundation.org
Cc: vkoul@...nel.org, linux-kernel@...r.kernel.org,
Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
Subject: [PATCH] bitfield.h: annotate type_replace_bits functions with __must_check
usage of apis like u32_replace_bits() without actually catching the return
value could hide problems without any warning!
Found this with recent usage of this api in SoundWire!
Having __must_check annotation would really catch this issues in future!
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
---
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 4e035aca6f7e..eb4f69253946 100644
--- a/include/linux/bitfield.h
+++ b/include/linux/bitfield.h
@@ -131,7 +131,7 @@ static __always_inline __##type type##_encode_bits(base v, base field) \
__field_overflow(); \
return to((v & field_mask(field)) * field_multiplier(field)); \
} \
-static __always_inline __##type type##_replace_bits(__##type old, \
+static __always_inline __must_check __##type type##_replace_bits(__##type old, \
base val, base field) \
{ \
return (old & ~to(field)) | type##_encode_bits(val, field); \
--
2.21.0
Powered by blists - more mailing lists