On Fri, Sep 16, 2016 6:08 PM Andrew Morton <a...@linux-foundation.org> wrote:

> >
> > +   if (!list_empty(&list))
> > +           list_for_each_entry(ch, &list, ch_node)
> > +                   riocm_send_close(ch);
> > +
> >     return NOTIFY_DONE;
> >  }
> 
> Fair enough.
> 
> Can we remove the !list_empty() test?

Sure. This check is not needed.

> 
> --- a/drivers/rapidio/rio_cm.c~rapidio-rio_cm-avoid-gfp_kernel-in-
> atomic-context-fix
> +++ a/drivers/rapidio/rio_cm.c
> @@ -2268,9 +2268,8 @@ static int rio_cm_shutdown(struct notifi
>       }
>       spin_unlock_bh(&idr_lock);
> 
> -     if (!list_empty(&list))
> -             list_for_each_entry(ch, &list, ch_node)
> -                     riocm_send_close(ch);
> +     list_for_each_entry(ch, &list, ch_node)
> +             riocm_send_close(ch);
> 
>       return NOTIFY_DONE;
>  }
> _

Reply via email to