]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ipmi: Use LIST_HEAD() to initialize on stack list head
authorJisheng Zhang <jszhang@kernel.org>
Tue, 19 May 2026 05:57:22 +0000 (13:57 +0800)
committerCorey Minyard <corey@minyard.net>
Tue, 19 May 2026 11:32:46 +0000 (06:32 -0500)
Use LIST_HEAD to initialize on stack list head. No intentional
functional impact.

Change generated with below coccinelle script:

@@
identifier name;
@@
- struct list_head name;
+ LIST_HEAD(name);
... when != name
- INIT_LIST_HEAD(&name);

Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
Message-ID: <20260519055722.13161-1-jszhang@kernel.org>
Signed-off-by: Corey Minyard <corey@minyard.net>
drivers/char/ipmi/ipmi_msghandler.c

index 869ac87a4b6ae80739d9d799849f7f3bda929bcd..7a4566046b68c1b720821e0cfa2f19ec668e256b 100644 (file)
@@ -1610,14 +1610,12 @@ int ipmi_set_gets_events(struct ipmi_user *user, bool val)
 {
        struct ipmi_smi      *intf = user->intf;
        struct ipmi_recv_msg *msg, *msg2;
-       struct list_head     msgs;
+       LIST_HEAD(msgs);
 
        user = acquire_ipmi_user(user);
        if (!user)
                return -ENODEV;
 
-       INIT_LIST_HEAD(&msgs);
-
        mutex_lock(&intf->events_mutex);
        if (user->gets_events == val)
                goto out;
@@ -3785,10 +3783,9 @@ static void cleanup_smi_msgs(struct ipmi_smi *intf)
        struct seq_table *ent;
        struct ipmi_smi_msg *msg;
        struct list_head *entry;
-       struct list_head tmplist;
+       LIST_HEAD(tmplist);
 
        /* Clear out our transmit queues and hold the messages. */
-       INIT_LIST_HEAD(&tmplist);
        list_splice_tail(&intf->hp_xmit_msgs, &tmplist);
        list_splice_tail(&intf->xmit_msgs, &tmplist);
 
@@ -4442,7 +4439,7 @@ static int handle_read_event_rsp(struct ipmi_smi *intf,
                                 struct ipmi_smi_msg *msg)
 {
        struct ipmi_recv_msg *recv_msg, *recv_msg2;
-       struct list_head     msgs;
+       LIST_HEAD(msgs);
        struct ipmi_user     *user;
        int rv = 0, deliver_count = 0;
 
@@ -4457,8 +4454,6 @@ static int handle_read_event_rsp(struct ipmi_smi *intf,
                return 0;
        }
 
-       INIT_LIST_HEAD(&msgs);
-
        mutex_lock(&intf->events_mutex);
 
        ipmi_inc_stat(intf, events);
@@ -5101,7 +5096,7 @@ static void check_msg_timeout(struct ipmi_smi *intf, struct seq_table *ent,
 static bool ipmi_timeout_handler(struct ipmi_smi *intf,
                                 unsigned long timeout_period)
 {
-       struct list_head     timeouts;
+       LIST_HEAD(timeouts);
        struct ipmi_recv_msg *msg, *msg2;
        unsigned long        flags;
        int                  i;
@@ -5120,7 +5115,6 @@ static bool ipmi_timeout_handler(struct ipmi_smi *intf,
         * have timed out, putting them in the timeouts
         * list.
         */
-       INIT_LIST_HEAD(&timeouts);
        mutex_lock(&intf->seq_lock);
        if (intf->ipmb_maintenance_mode_timeout) {
                if (intf->ipmb_maintenance_mode_timeout <= timeout_period)