checkpatch: enable volatile warning
PATCH 1/1 checkpatch: enable volatile warning
Enable volatile considered harmful warning since use of volatile is suspect.
--- devtools/checkpatches.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
devtools/checkpatches.sh +1 -1
@@ -29,7 +29,7 @@ options="$options --max-line-length=$length" options="$options --show-types" options="$options --ignore=LINUX_VERSION_CODE,ENOSYS,\ FILE_PATH_CHANGES,MAINTAINERS_STYLE,SPDX_LICENSE_TAG,\ -VOLATILE,PREFER_PACKED,PREFER_ALIGNED,PREFER_PRINTF,\ +PREFER_PACKED,PREFER_ALIGNED,PREFER_PRINTF,\ PREFER_KERNEL_TYPES,PREFER_FALLTHROUGH,BIT_MACRO,CONST_STRUCT,\ SPLIT_STRING,LONG_LINE_STRING,C99_COMMENT_TOLERANCE,\ LINE_SPACING,PARENTHESIS_ALIGNMENT,NETWORKING_BLOCK_COMMENT_STYLE,\
Signature · 1 line
2.17.1
10/03/2021 12:04, Dharmik Thakkar:
Quoted 6 lines
Enable volatile considered harmful warning since use of volatile is suspect.
Suggested-by Stephen Hemminger <[email protected]>Signed-off-by Dharmik Thakkar <[email protected]>Reviewed-by Ruifeng Wang <[email protected]>
git grep -w volatile | wc -l
1796
How much is it suspect?
Quoted 4 lines · On Wed, 10 Mar 2021 12:10:01 +0100 Thomas Monjalon <[email protected]> wrote:
10/03/2021 12:04, Dharmik Thakkar:
Quoted 3 lines
Enable volatile considered harmful warning since use of volatile is suspect.
Quoted 10 lines
Quoted 3 lines
Suggested-by Stephen Hemminger <[email protected]>Signed-off-by Dharmik Thakkar <[email protected]>Reviewed-by Ruifeng Wang <[email protected]>git grep -w volatile | wc -l
1796How much is it suspect?
Many seem to be unsafe.
testpmd: uses flags values in unsafe manner
it also uses volatile when accessing hardware registers
test-alarm is expecting that alarm() is a signal
(it is not)
test-atomic is ok
test-barrier is doing barriers and not using __atomic
drivers use volatile to mark hardware registers.
It is still true volatile is not enough are not weak memory model.
Hi,
Apologies for the delayed response!
Quoted 27 lines · Stephen Hemminger
Quoted 4 lines · On Wed, 10 Mar 2021 12:10:01 +0100 Thomas Monjalon <[email protected]> wrote:
10/03/2021 12:04, Dharmik Thakkar:
Quoted 3 lines
Enable volatile considered harmful warning since use of volatile is suspect.
Quoted 10 lines
Quoted 3 lines
Suggested-by Stephen Hemminger <[email protected]>Signed-off-by Dharmik Thakkar <[email protected]>Reviewed-by Ruifeng Wang <[email protected]>git grep -w volatile | wc -l
1796How much is it suspect?
Many seem to be unsafe.
testpmd: uses flags values in unsafe manner
it also uses volatile when accessing hardware registerstest-alarm is expecting that
alarm()is a signal
(it is not)
Quoted 6 lines
test-atomic is ok
test-barrier is doing barriers and not using__atomicdrivers use volatile to mark hardware registers.
It is still true volatile is not enough are not weak memory model.
Agree, and this warning should help avoid such unsafe / incorrect use of volatile for future patches.