]> www.infradead.org Git - users/mchehab/rasdaemon.git/commit
mce-intel-*: fix a warning when using FIELD(<num>, NULL)
authorMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Tue, 14 Aug 2018 16:06:27 +0000 (13:06 -0300)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Tue, 14 Aug 2018 16:06:27 +0000 (13:06 -0300)
commita8c776ed94f68ae31d7b5f74e19545698898c13c
treea17402ece7b522a8f86f2095a1cf781418ecd591
parent0b6b6c5762f385b0d024355b926843519ca7b7cc
mce-intel-*: fix a warning when using FIELD(<num>, NULL)

Internally, FIELD() macro checks the size of an array, by
using ARRAY_SIZE. Well, this macro causes a division by zero
if NULL is used, as its type is void, as warned:

mce-intel-dunnington.c:30:2: note: in expansion of macro ‘FIELD’
  FIELD(17, NULL),
  ^~~~~
ras-mce-handler.h:28:33: warning: division ‘sizeof (void *) / sizeof (void)’ does not compute the number of array elements [-Wsizeof-pointer-div]
 #define ARRAY_SIZE(x) (sizeof(x)/sizeof(*(x)))
                                 ^
bitfield.h:37:51: note: in expansion of macro ‘ARRAY_SIZE’
 #define FIELD(start_bit, name) { start_bit, name, ARRAY_SIZE(name) }
                                                   ^~~~~~~~~~

While this warning is harmless, it may prevent seeing more serios
warnings. So, add a FIELD_NULL(<num>) macro to avoid that.

Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
bitfield.h
mce-intel-dunnington.c
mce-intel-p4-p6.c
mce-intel-tulsa.c