From: OGAWA Hirofumi Date: Mon, 24 May 2010 21:33:11 +0000 (-0700) Subject: printk_ratelimited(): fix uninitialized spinlock X-Git-Tag: MMI-PSA29.97-13-9~23733 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d8521fcc5e0ad3e79bbc4231bb20a6cdc2b50164;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git 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: OGAWA Hirofumi Cc: Joe Perches Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/include/linux/kernel.h b/include/linux/kernel.h index ea8490d7020e..05f332afc9e0 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -424,14 +424,13 @@ static inline char *pack_hex_byte(char *buf, u8 byte) * no local ratelimit_state used in the !PRINTK case */ #ifdef CONFIG_PRINTK -#define printk_ratelimited(fmt, ...) ({ \ - static struct ratelimit_state _rs = { \ - .interval = DEFAULT_RATELIMIT_INTERVAL, \ - .burst = DEFAULT_RATELIMIT_BURST, \ - }; \ - \ - if (__ratelimit(&_rs)) \ - printk(fmt, ##__VA_ARGS__); \ +#define printk_ratelimited(fmt, ...) ({ \ + static DEFINE_RATELIMIT_STATE(_rs, \ + DEFAULT_RATELIMIT_INTERVAL, \ + DEFAULT_RATELIMIT_BURST); \ + \ + if (__ratelimit(&_rs)) \ + printk(fmt, ##__VA_ARGS__); \ }) #else /* No effect, but we still get type checking even in the !PRINTK case: */