lkml.org 
[lkml]   [2022]   [Jun]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[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 <jbi.octave@gmail.com>
---
kernel/bpf/btf.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
index 1bc496162572..95c1ee525e28 100644
--- a/kernel/bpf/btf.c
+++ b/kernel/bpf/btf.c
@@ -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;
--
2.36.1
\
 
 \ /
  Last update: 2022-06-29 19:20    [W:0.156 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site