RE: [PATCH 1/1] rapidio/rio_cm: avoid GFP_KERNEL in atomic context

From: Bounine, Alexandre
Date: Mon Sep 19 2016 - 10:05:30 EST


On Fri, Sep 16, 2016 6:08 PM Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> 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;
> }
> _