Skip to contentSkip to conversation

Possible false positive from checkpatch.pl?

DISCUSSION Joe Perches 1 participant 1 message Aug 9, 2021 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 49 lines · Madhavan T. Venkataraman

Hi,

I have defined the SYM_CODE_END() macro for ARM64 in arch/arm64/include/asm/linkage.h like this:

#define SYM_CODE_END(name) \

        SYM_END(name, SYM_T_NONE)                       ;\
        99:                                             ;\
        .pushsection "sym_code_functions", "aw"         ;\
        .quad   name                                    ;\
        .quad   99b                                     ;\

        .popsection

SYM_CODE_START() and SYM_CODE_END() macros are only used while defining assembly functions. They are never used in C code.

But checkpatch.pl is emitting the following messages (enclosed within ========). Looks like it is treating them like macros used in C code.

=================
ERROR: Macros with multiple statements should be enclosed in a do - while loop #21: FILE: arch/arm64/include/asm/linkage.h:68:

(quoted diff) +7 -0
+#define SYM_CODE_END(name)				\
+	SYM_END(name, SYM_T_NONE)			;\
+	99:						;\
+	.pushsection "sym_code_functions", "aw"		;\
+	.quad	name					;\
+	.quad	99b					;\
+	.popsection

ERROR: spaces required around that ':' (ctx:VxW)
#23: FILE: arch/arm64/include/asm/linkage.h:70:

(quoted diff) +1 -0
+	99:						;\

  ^

WARNING: labels should not be indented
#23: FILE: arch/arm64/include/asm/linkage.h:70:

(quoted diff) +1 -0
+	99:						;\

total: 2 errors, 1 warnings, 124 lines checked

Wrote EXPERIMENTAL --fix correction(s) to '/tmp/x.EXPERIMENTAL-checkpatch-fixes'

Do _NOT_ trust the results written to this file.
Do _NOT_ submit these changes without inspecting them for correctness.

This EXPERIMENTAL file is simply a convenience to help rewrite patches. No warranties, expressed or implied...

Quoted 7 lines

/tmp/x has style problems, please review.

NOTE: If any of the errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS.
==================

How do I fix this? Can you please help?

Fix checkpatch? If you _really_ want, you could change checkpatch to skip .h file tests when $realfile =~ m@/asm/@;

Otherwise, just be sensible and ignore checkpatch output that doesn't make sense. It's a stupid brainless script. You are not.

Quoted 4 lines

Thanks in advance.

Madhavan T. Venkataraman