* [PATCH] linux/ratelimit.h: fixed "missing initializer" warning
@ 2008-10-16 10:45 Max Kellermann
0 siblings, 0 replies; only message in thread
From: Max Kellermann @ 2008-10-16 10:45 UTC (permalink / raw)
To: linux-kernel
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 <mk@cm4all.com>
---
include/linux/ratelimit.h | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/include/linux/ratelimit.h b/include/linux/ratelimit.h
index 18a5b9b..cb29b0c 100644
--- a/include/linux/ratelimit.h
+++ b/include/linux/ratelimit.h
@@ -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);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-10-16 11:07 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-16 10:45 [PATCH] linux/ratelimit.h: fixed "missing initializer" warning Max Kellermann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®