ipmi: Add an intializer for ipmi_smi_msg struct
authorCorey Minyard <cminyard@mvista.com>
Tue, 12 Apr 2022 20:38:51 +0000 (15:38 -0500)
committerCorey Minyard <cminyard@mvista.com>
Thu, 12 May 2022 15:00:03 +0000 (10:00 -0500)
There was a "type" element added to this structure, but some static
values were missed.  The default value will be zero, which is correct,
but create an initializer for the type and initialize the type properly
in the initializer to avoid future issues.

Reported-by: Joe Wiese <jwiese@rackspace.com>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
drivers/char/ipmi/ipmi_poweroff.c
drivers/char/ipmi/ipmi_watchdog.c
include/linux/ipmi_smi.h

index bc3a18daf97a6857ce95ae3b7a868669d14339d9..62e71c46ac5f72576f2cab9123516a3c70377cc8 100644 (file)
@@ -94,9 +94,7 @@ static void dummy_recv_free(struct ipmi_recv_msg *msg)
 {
        atomic_dec(&dummy_count);
 }
-static struct ipmi_smi_msg halt_smi_msg = {
-       .done = dummy_smi_free
-};
+static struct ipmi_smi_msg halt_smi_msg = INIT_IPMI_SMI_MSG(dummy_smi_free);
 static struct ipmi_recv_msg halt_recv_msg = {
        .done = dummy_recv_free
 };
index 0604abdd249a14bda5f3c7388582e58a2c548735..4c1e9663ea479aba5907cf9b11ca8901ce5d688a 100644 (file)
@@ -354,9 +354,7 @@ static void msg_free_recv(struct ipmi_recv_msg *msg)
                        complete(&msg_wait);
        }
 }
-static struct ipmi_smi_msg smi_msg = {
-       .done = msg_free_smi
-};
+static struct ipmi_smi_msg smi_msg = INIT_IPMI_SMI_MSG(msg_free_smi);
 static struct ipmi_recv_msg recv_msg = {
        .done = msg_free_recv
 };
@@ -475,9 +473,8 @@ static void panic_recv_free(struct ipmi_recv_msg *msg)
        atomic_dec(&panic_done_count);
 }
 
-static struct ipmi_smi_msg panic_halt_heartbeat_smi_msg = {
-       .done = panic_smi_free
-};
+static struct ipmi_smi_msg panic_halt_heartbeat_smi_msg =
+       INIT_IPMI_SMI_MSG(panic_smi_free);
 static struct ipmi_recv_msg panic_halt_heartbeat_recv_msg = {
        .done = panic_recv_free
 };
@@ -516,9 +513,8 @@ static void panic_halt_ipmi_heartbeat(void)
                atomic_sub(2, &panic_done_count);
 }
 
-static struct ipmi_smi_msg panic_halt_smi_msg = {
-       .done = panic_smi_free
-};
+static struct ipmi_smi_msg panic_halt_smi_msg =
+       INIT_IPMI_SMI_MSG(panic_smi_free);
 static struct ipmi_recv_msg panic_halt_recv_msg = {
        .done = panic_recv_free
 };
index 9277d21c2690cc6daff1f576060d7a4667d49d1d..5d69820d8b027e1076cf8705d282b43b0c2a9733 100644 (file)
@@ -125,6 +125,12 @@ struct ipmi_smi_msg {
        void (*done)(struct ipmi_smi_msg *msg);
 };
 
+#define INIT_IPMI_SMI_MSG(done_handler) \
+{                                              \
+       .done = done_handler,                   \
+       .type = IPMI_SMI_MSG_TYPE_NORMAL        \
+}
+
 struct ipmi_smi_handlers {
        struct module *owner;