btf: Fix error of Macros with multiple statements
Subsystems (3)
PATCH 2/2 btf: Fix error of Macros with multiple statements
This patch fixes an error reported by checkpatch.pl
ERROR: Macros with multiple statements should be
enclosed in a do while loop
To fix this a do while(0) loop is used
to encloses the multiple statements.
Signed-off-by Jules Irenge <[email protected]>
--- kernel/bpf/btf.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
kernel/bpf/btf.c +4 -2
@@ -5057,8 +5057,10 @@ extern struct btf *btf_vmlinux; static union { struct bpf_ctx_convert { #define BPF_PROG_TYPE(_id, _name, prog_ctx_type, kern_ctx_type) \ - prog_ctx_type _id##_prog; \ - kern_ctx_type _id##_kern; + do { \ + prog_ctx_type _id##_prog; \ + kern_ctx_type _id##_kern; \ + } while (0) #include <linux/bpf_types.h> #undef BPF_PROG_TYPE } *__t;
Signature · 1 line
2.36.1
Quoted 1 line · Jules Irenge
This patch fixes an error reported by checkpatch.pl
No. It is not a fix.
Have you at least compiler tested it ?
Quoted 32 lines
ERROR: Macros with multiple statements should be
enclosed in a do while loopTo fix this a do while(0) loop is used
to encloses the multiple statements.Signed-off-by Jules Irenge <[email protected]>--- kernel/bpf/btf.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)kernel/bpf/btf.c +4
-2@@ -5057,8 +5057,10 @@ extern struct btf *btf_vmlinux; static union { struct bpf_ctx_convert { #define BPF_PROG_TYPE(_id, _name, prog_ctx_type, kern_ctx_type) \ - prog_ctx_type _id##_prog; \ - kern_ctx_type _id##_kern; + do { \ + prog_ctx_type _id##_prog; \ + kern_ctx_type _id##_kern; \ + } while (0) #include <linux/bpf_types.h> #undef BPF_PROG_TYPE } *__t;Signature · 1 line
2.36.1