krishnanadh / rpms / rasdaemon

Forked from rpms/rasdaemon a year ago
Clone
d77db6
commit a8c776ed94f68ae31d7b5f74e19545698898c13c
d77db6
Author: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
d77db6
Date:   Tue Aug 14 13:06:27 2018 -0300
d77db6
d77db6
    mce-intel-*: fix a warning when using FIELD(<num>, NULL)
d77db6
    
d77db6
    Internally, FIELD() macro checks the size of an array, by
d77db6
    using ARRAY_SIZE. Well, this macro causes a division by zero
d77db6
    if NULL is used, as its type is void, as warned:
d77db6
    
d77db6
            mce-intel-dunnington.c:30:2: note: in expansion of macro ‘FIELD’
d77db6
              FIELD(17, NULL),
d77db6
              ^~~~~
d77db6
            ras-mce-handler.h:28:33: warning: division ‘sizeof (void *) / sizeof (void)’ does not compute the number of array elements [-Wsizeof-pointer-div]
d77db6
             #define ARRAY_SIZE(x) (sizeof(x)/sizeof(*(x)))
d77db6
                                             ^
d77db6
            bitfield.h:37:51: note: in expansion of macro ‘ARRAY_SIZE’
d77db6
             #define FIELD(start_bit, name) { start_bit, name, ARRAY_SIZE(name) }
d77db6
                                                               ^~~~~~~~~~
d77db6
    
d77db6
    While this warning is harmless, it may prevent seeing more serios
d77db6
    warnings. So, add a FIELD_NULL(<num>) macro to avoid that.
d77db6
    
d77db6
    Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
d77db6
d77db6
diff --git a/bitfield.h b/bitfield.h
d77db6
index c7dfeb1..fccbb36 100644
d77db6
--- a/bitfield.h
d77db6
+++ b/bitfield.h
d77db6
@@ -35,6 +35,7 @@ struct numfield {
d77db6
 };
d77db6
 
d77db6
 #define FIELD(start_bit, name) { start_bit, name, ARRAY_SIZE(name) }
d77db6
+#define FIELD_NULL(start_bit) { start_bit, NULL, 0 }
d77db6
 #define SBITFIELD(start_bit, string) { start_bit, ((char * [2]) { NULL, string }), 2 }
d77db6
 
d77db6
 #define NUMBER(start, end, name) { start, end, name, "%Lu", 0 }
d77db6
diff --git a/mce-intel-dunnington.c b/mce-intel-dunnington.c
d77db6
index 4b1c7e3..c695c62 100644
d77db6
--- a/mce-intel-dunnington.c
d77db6
+++ b/mce-intel-dunnington.c
d77db6
@@ -27,14 +27,14 @@
d77db6
 
d77db6
 static struct field dunnington_bus_status[] = {
d77db6
 	SBITFIELD(16, "Parity error detected during FSB request phase"),
d77db6
-	FIELD(17, NULL),
d77db6
+	FIELD_NULL(17),
d77db6
 	SBITFIELD(20, "Hard Failure response received for a local transaction"),
d77db6
 	SBITFIELD(21, "Parity error on FSB response field detected"),
d77db6
 	SBITFIELD(22, "Parity data error on inbound data detected"),
d77db6
-	FIELD(23, NULL),
d77db6
-	FIELD(25, NULL),
d77db6
-	FIELD(28, NULL),
d77db6
-	FIELD(31, NULL),
d77db6
+	FIELD_NULL(23),
d77db6
+	FIELD_NULL(25),
d77db6
+	FIELD_NULL(28),
d77db6
+	FIELD_NULL(31),
d77db6
 	{}
d77db6
 };
d77db6
 
d77db6
diff --git a/mce-intel-p4-p6.c b/mce-intel-p4-p6.c
d77db6
index 4615e1a..5c6c3ff 100644
d77db6
--- a/mce-intel-p4-p6.c
d77db6
+++ b/mce-intel-p4-p6.c
d77db6
@@ -60,7 +60,7 @@ static char *bus_queue_error_type[] = {
d77db6
 };
d77db6
 
d77db6
 static struct field p6_shared_status[] = {
d77db6
-	FIELD(16, NULL),
d77db6
+	FIELD_NULL(16),
d77db6
 	FIELD(19, bus_queue_req_type),
d77db6
 	FIELD(25, bus_queue_error_type),
d77db6
 	FIELD(25, bus_queue_error_type),
d77db6
@@ -68,7 +68,7 @@ static struct field p6_shared_status[] = {
d77db6
 	SBITFIELD(36, "received parity error on response transaction"),
d77db6
 	SBITFIELD(38, "timeout BINIT (ROB timeout)."
d77db6
 		  " No micro-instruction retired for some time"),
d77db6
-	FIELD(39, NULL),
d77db6
+	FIELD_NULL(39),
d77db6
 	SBITFIELD(42, "bus transaction received hard error response"),
d77db6
 	SBITFIELD(43, "failure that caused IERR"),
d77db6
 	/* The following are reserved for Core in the SDM. Let's keep them here anyways*/
d77db6
@@ -76,15 +76,15 @@ static struct field p6_shared_status[] = {
d77db6
 	SBITFIELD(45, "uncorrectable ECC error"),
d77db6
 	SBITFIELD(46, "correctable ECC error"),
d77db6
 	/* [47..54]: ECC syndrome */
d77db6
-	FIELD(55, NULL),
d77db6
+	FIELD_NULL(55),
d77db6
 	{},
d77db6
 };
d77db6
 
d77db6
 static struct field p6old_status[] = {
d77db6
 	SBITFIELD(28, "FRC error"),
d77db6
 	SBITFIELD(29, "BERR on this CPU"),
d77db6
-	FIELD(31, NULL),
d77db6
-	FIELD(32, NULL),
d77db6
+	FIELD_NULL(31),
d77db6
+	FIELD_NULL(32),
d77db6
 	SBITFIELD(35, "BINIT received from external bus"),
d77db6
 	SBITFIELD(37, "Received hard error reponse on split transaction (Bus BINIT)"),
d77db6
 	{}
d77db6
@@ -94,9 +94,9 @@ static struct field core2_status[] = {
d77db6
 	SBITFIELD(28, "MCE driven"),
d77db6
 	SBITFIELD(29, "MCE is observed"),
d77db6
 	SBITFIELD(31, "BINIT observed"),
d77db6
-	FIELD(32, NULL),
d77db6
+	FIELD_NULL(32),
d77db6
 	SBITFIELD(34, "PIC or FSB data parity error"),
d77db6
-	FIELD(35, NULL),
d77db6
+	FIELD_NULL(35),
d77db6
 	SBITFIELD(37, "FSB address parity error detected"),
d77db6
 	{}
d77db6
 };
d77db6
diff --git a/mce-intel-tulsa.c b/mce-intel-tulsa.c
d77db6
index 6cea421..e59bf06 100644
d77db6
--- a/mce-intel-tulsa.c
d77db6
+++ b/mce-intel-tulsa.c
d77db6
@@ -39,7 +39,7 @@ static struct field tls_bus_status[] = {
d77db6
 	SBITFIELD(16, "Parity error detected during FSB request phase"),
d77db6
 	SBITFIELD(17, "Partity error detected on Core 0 request's address field"),
d77db6
 	SBITFIELD(18, "Partity error detected on Core 1 request's address field"),
d77db6
-	FIELD(19, NULL),
d77db6
+	FIELD_NULL(19),
d77db6
 	SBITFIELD(20, "Parity error on FSB response field detected"),
d77db6
 	SBITFIELD(21, "FSB data parity error on inbound date detected"),
d77db6
 	SBITFIELD(22, "Data parity error on data received from Core 0 detected"),
d77db6
@@ -48,8 +48,8 @@ static struct field tls_bus_status[] = {
d77db6
 	SBITFIELD(25, "Data ECC event to error on inbound data correctable or uncorrectable"),
d77db6
 	SBITFIELD(26, "Pad logic detected a data strobe glitch or sequencing error"),
d77db6
 	SBITFIELD(27, "Pad logic detected a request strobe glitch or sequencing error"),
d77db6
-	FIELD(28, NULL),
d77db6
-	FIELD(31, NULL),
d77db6
+	FIELD_NULL(28),
d77db6
+	FIELD_NULL(31),
d77db6
 	{}
d77db6
 };
d77db6