Skip to content

Commit 9824117

Browse files
committed
ipmi: Add an intializer for ipmi_smi_msg struct
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>
1 parent 7602b95 commit 9824117

3 files changed

Lines changed: 12 additions & 12 deletions

File tree

drivers/char/ipmi/ipmi_poweroff.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,7 @@ static void dummy_recv_free(struct ipmi_recv_msg *msg)
9494
{
9595
atomic_dec(&dummy_count);
9696
}
97-
static struct ipmi_smi_msg halt_smi_msg = {
98-
.done = dummy_smi_free
99-
};
97+
static struct ipmi_smi_msg halt_smi_msg = INIT_IPMI_SMI_MSG(dummy_smi_free);
10098
static struct ipmi_recv_msg halt_recv_msg = {
10199
.done = dummy_recv_free
102100
};

drivers/char/ipmi/ipmi_watchdog.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -354,9 +354,7 @@ static void msg_free_recv(struct ipmi_recv_msg *msg)
354354
complete(&msg_wait);
355355
}
356356
}
357-
static struct ipmi_smi_msg smi_msg = {
358-
.done = msg_free_smi
359-
};
357+
static struct ipmi_smi_msg smi_msg = INIT_IPMI_SMI_MSG(msg_free_smi);
360358
static struct ipmi_recv_msg recv_msg = {
361359
.done = msg_free_recv
362360
};
@@ -475,9 +473,8 @@ static void panic_recv_free(struct ipmi_recv_msg *msg)
475473
atomic_dec(&panic_done_count);
476474
}
477475

478-
static struct ipmi_smi_msg panic_halt_heartbeat_smi_msg = {
479-
.done = panic_smi_free
480-
};
476+
static struct ipmi_smi_msg panic_halt_heartbeat_smi_msg =
477+
INIT_IPMI_SMI_MSG(panic_smi_free);
481478
static struct ipmi_recv_msg panic_halt_heartbeat_recv_msg = {
482479
.done = panic_recv_free
483480
};
@@ -516,9 +513,8 @@ static void panic_halt_ipmi_heartbeat(void)
516513
atomic_sub(2, &panic_done_count);
517514
}
518515

519-
static struct ipmi_smi_msg panic_halt_smi_msg = {
520-
.done = panic_smi_free
521-
};
516+
static struct ipmi_smi_msg panic_halt_smi_msg =
517+
INIT_IPMI_SMI_MSG(panic_smi_free);
522518
static struct ipmi_recv_msg panic_halt_recv_msg = {
523519
.done = panic_recv_free
524520
};

include/linux/ipmi_smi.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,12 @@ struct ipmi_smi_msg {
125125
void (*done)(struct ipmi_smi_msg *msg);
126126
};
127127

128+
#define INIT_IPMI_SMI_MSG(done_handler) \
129+
{ \
130+
.done = done_handler, \
131+
.type = IPMI_SMI_MSG_TYPE_NORMAL \
132+
}
133+
128134
struct ipmi_smi_handlers {
129135
struct module *owner;
130136

0 commit comments

Comments
 (0)