On Tue, May 19, 2026 at 01:57:22PM +0800, Jisheng Zhang wrote:
> Use LIST_HEAD to initialize on stack list head. No intentional
> functional impact.

Thanks, this is in my next tree.

-corey

> 
> 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 <[email protected]>
> ---
>  drivers/char/ipmi/ipmi_msghandler.c | 14 ++++----------
>  1 file changed, 4 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/char/ipmi/ipmi_msghandler.c 
> b/drivers/char/ipmi/ipmi_msghandler.c
> index 869ac87a4b6a..7a4566046b68 100644
> --- a/drivers/char/ipmi/ipmi_msghandler.c
> +++ b/drivers/char/ipmi/ipmi_msghandler.c
> @@ -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)
> -- 
> 2.53.0
> 


_______________________________________________
Openipmi-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openipmi-developer

Reply via email to