linux/ratelimit.h: fixed "missing initializer" warning
PATCH 1/1 linux/ratelimit.h: fixed "missing initializer" warning
When compiled with -Wmissing-field-initializers (-Wextra), gcc complains that there are uninitialized fields in the struct:
include/linux/ratelimit.h: In function 'ratelimit':
include/linux/ratelimit.h:23: warning: missing initializer include/linux/ratelimit.h:23: warning: (near initialization for 'rs.printed')
Work around this by using C99 initializers. This seems more safe anyway, just in case someone changes the ratelimit_state struct.
Signed-off-by Max Kellermann <[email protected]>
---
include/linux/ratelimit.h | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-)
include/linux/ratelimit.h +5 -2
@@ -13,8 +13,11 @@ struct ratelimit_state {unsigned long begin; }; -#define DEFINE_RATELIMIT_STATE (name, interval, burst) \ - struct ratelimit_state name = {interval, burst,} +#define DEFINE_RATELIMIT_STATE (name, _interval, _burst) \ + struct ratelimit_state name = { \ + .interval = _interval, \ + .burst = _burst, \ + }extern int __ratelimit (struct ratelimit_state *rs);