Skip to contentSkip to conversation

kfifo: initialize fifo accordingly to C99 standard

PATCH Superseded Andy Shevchenko 1 participant 1 message Nov 21, 2012 Kfifo

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kfifo: initialize fifo accordingly to C99 standard

When build a kernel with "make W=1" we will get a warning about missing initializer. It comes from kfifo usage style. The DEFINE_KFIFO macro doesn't initialize the buf[] field of the fifo structure. So, using C99 style helps in such case.

Cc Stefani Seibold <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
---
 include/linux/kfifo.h |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
include/linux/kfifo.h +1 -4
index 10308c6..3de51a1 100644
@@ -155,8 +155,7 @@ struct kfifo_rec_ptr_2 __STRUCT_KFIFO_PTR(unsigned char, 2, void);
 #define DEFINE_KFIFO(fifo, type, size) \
 	DECLARE_KFIFO(fifo, type, size) = \
 	(typeof(fifo)) { \
-		{ \
-			{ \
+		.kfifo = { \
 			.in	= 0, \
 			.out	= 0, \
 			.mask	= __is_kfifo_ptr(&(fifo)) ? \
@@ -166,11 +165,9 @@ struct kfifo_rec_ptr_2 __STRUCT_KFIFO_PTR(unsigned char, 2, void);
 			.data	= __is_kfifo_ptr(&(fifo)) ? \
 				NULL : \
 				(fifo).buf, \
-			} \
 		} \
 	}
 
-
 static inline unsigned int __must_check
 __kfifo_uint_must_check_helper(unsigned int val)
 {
Signature · 1 line
1.7.10.4