Commit d8521fcc authored by OGAWA Hirofumi's avatar OGAWA Hirofumi Committed by Linus Torvalds

printk_ratelimited(): fix uninitialized spinlock

ratelimit_state initialization of printk_ratelimited() seems broken.  This
fixes it by using DEFINE_RATELIMIT_STATE() to initialize spinlock
properly.
Signed-off-by: default avatarOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent fa1f68db
...@@ -425,10 +425,9 @@ static inline char *pack_hex_byte(char *buf, u8 byte) ...@@ -425,10 +425,9 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
*/ */
#ifdef CONFIG_PRINTK #ifdef CONFIG_PRINTK
#define printk_ratelimited(fmt, ...) ({ \ #define printk_ratelimited(fmt, ...) ({ \
static struct ratelimit_state _rs = { \ static DEFINE_RATELIMIT_STATE(_rs, \
.interval = DEFAULT_RATELIMIT_INTERVAL, \ DEFAULT_RATELIMIT_INTERVAL, \
.burst = DEFAULT_RATELIMIT_BURST, \ DEFAULT_RATELIMIT_BURST); \
}; \
\ \
if (__ratelimit(&_rs)) \ if (__ratelimit(&_rs)) \
printk(fmt, ##__VA_ARGS__); \ printk(fmt, ##__VA_ARGS__); \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment