diff options
author | Arnd Bergmann <arnd@arndb.de> | 2015-01-28 10:00:11 -0500 |
---|---|---|
committer | Corey Minyard <cminyard@mvista.com> | 2015-02-19 21:58:18 -0500 |
commit | 191cc41405188780e5f8f3c90d84a1e747d962e9 (patch) | |
tree | ddc2a596ae5f6abfe58271ffec0417f40685f05c | |
parent | 48862ea2ce86370b708614506d93f07ed09b066f (diff) |
ipmi: avoid gcc warning
A new harmless warning has come up on ARM builds with gcc-4.9:
drivers/char/ipmi/ipmi_msghandler.c: In function 'smi_send.isra.11':
include/linux/spinlock.h:372:95: warning: 'flags' may be used uninitialized in this function [-Wmaybe-uninitialized]
raw_spin_unlock_irqrestore(&lock->rlock, flags);
^
drivers/char/ipmi/ipmi_msghandler.c:1490:16: note: 'flags' was declared here
unsigned long flags;
^
This could be worked around by initializing the 'flags' variable, but it
seems better to rework the code to avoid this.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 7ea0ed2b5be81 ("ipmi: Make the message handler easier to use for SMI interfaces")
Signed-off-by: Corey Minyard <cminyard@mvista.com>
-rw-r--r-- | drivers/char/ipmi/ipmi_msghandler.c | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c index ab595410169d..4891c39b3259 100644 --- a/drivers/char/ipmi/ipmi_msghandler.c +++ b/drivers/char/ipmi/ipmi_msghandler.c | |||
@@ -1483,14 +1483,10 @@ static inline void format_lan_msg(struct ipmi_smi_msg *smi_msg, | |||
1483 | smi_msg->msgid = msgid; | 1483 | smi_msg->msgid = msgid; |
1484 | } | 1484 | } |
1485 | 1485 | ||
1486 | static void smi_send(ipmi_smi_t intf, struct ipmi_smi_handlers *handlers, | 1486 | static struct ipmi_smi_msg *smi_add_send_msg(ipmi_smi_t intf, |
1487 | struct ipmi_smi_msg *smi_msg, int priority) | 1487 | struct ipmi_smi_msg *smi_msg, |
1488 | int priority) | ||
1488 | { | 1489 | { |
1489 | int run_to_completion = intf->run_to_completion; | ||
1490 | unsigned long flags; | ||
1491 | |||
1492 | if (!run_to_completion) | ||
1493 | spin_lock_irqsave(&intf->xmit_msgs_lock, flags); | ||
1494 | if (intf->curr_msg) { | 1490 | if (intf->curr_msg) { |
1495 | if (priority > 0) | 1491 | if (priority > 0) |
1496 | list_add_tail(&smi_msg->link, &intf->hp_xmit_msgs); | 1492 | list_add_tail(&smi_msg->link, &intf->hp_xmit_msgs); |
@@ -1500,8 +1496,25 @@ static void smi_send(ipmi_smi_t intf, struct ipmi_smi_handlers *handlers, | |||
1500 | } else { | 1496 | } else { |
1501 | intf->curr_msg = smi_msg; | 1497 | intf->curr_msg = smi_msg; |
1502 | } | 1498 | } |
1503 | if (!run_to_completion) | 1499 | |
1500 | return smi_msg; | ||
1501 | } | ||
1502 | |||
1503 | |||
1504 | static void smi_send(ipmi_smi_t intf, struct ipmi_smi_handlers *handlers, | ||
1505 | struct ipmi_smi_msg *smi_msg, int priority) | ||
1506 | { | ||
1507 | int run_to_completion = intf->run_to_completion; | ||
1508 | |||
1509 | if (run_to_completion) { | ||
1510 | smi_msg = smi_add_send_msg(intf, smi_msg, priority); | ||
1511 | } else { | ||
1512 | unsigned long flags; | ||
1513 | |||
1514 | spin_lock_irqsave(&intf->xmit_msgs_lock, flags); | ||
1515 | smi_msg = smi_add_send_msg(intf, smi_msg, priority); | ||
1504 | spin_unlock_irqrestore(&intf->xmit_msgs_lock, flags); | 1516 | spin_unlock_irqrestore(&intf->xmit_msgs_lock, flags); |
1517 | } | ||
1505 | 1518 | ||
1506 | if (smi_msg) | 1519 | if (smi_msg) |
1507 | handlers->sender(intf->send_info, smi_msg); | 1520 | handlers->sender(intf->send_info, smi_msg); |