From: Max Kellermann <mk@cm4all.com>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] linux/ratelimit.h: fixed "missing initializer" warning
Date: Thu, 16 Oct 2008 12:45:11 +0200 [thread overview]
Message-ID: <20081016104511.28037.13905.stgit@rabbit.intern.cm-ag> (raw)
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);
reply other threads:[~2008-10-16 11:07 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20081016104511.28037.13905.stgit@rabbit.intern.cm-ag \
--to=mk@cm4all.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®