devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
To: Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org>
Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
	Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>
Subject: Re: [PATCH] of/irq: Avoid calling list_first_entry() for empty list
Date: Sat, 20 Jul 2013 06:35:18 +0100	[thread overview]
Message-ID: <20130720053519.41B773E170B@localhost> (raw)
In-Reply-To: <1371973807.23555.1.camel@phoenix>

On Sun, 23 Jun 2013 15:50:07 +0800, Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org> wrote:
> list_first_entry() expects the list is not empty, we need to check if list is
> empty before calling list_first_entry(). Thus use list_first_entry_or_null()
> instead of list_first_entry().
> 
> Signed-off-by: Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org>

Applied, thanks.

g.

> ---
>  drivers/of/irq.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/of/irq.c b/drivers/of/irq.c
> index a3c1c5a..5c645c7 100644
> --- a/drivers/of/irq.c
> +++ b/drivers/of/irq.c
> @@ -482,8 +482,9 @@ void __init of_irq_init(const struct of_device_id *matches)
>  		}
>  
>  		/* Get the next pending parent that might have children */
> -		desc = list_first_entry(&intc_parent_list, typeof(*desc), list);
> -		if (list_empty(&intc_parent_list) || !desc) {
> +		desc = list_first_entry_or_null(&intc_parent_list,
> +						typeof(*desc), list);
> +		if (!desc) {
>  			pr_err("of_irq_init: children remain, but no parents\n");
>  			break;
>  		}
> -- 
> 1.8.1.2
> 
> 
> 

      reply	other threads:[~2013-07-20  5:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-23  7:50 [PATCH] of/irq: Avoid calling list_first_entry() for empty list Axel Lin
2013-07-20  5:35 ` Grant Likely [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130720053519.41B773E170B@localhost \
    --to=grant.likely-s3s/wqlpoipyb63q8fvjnq@public.gmane.org \
    --cc=axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org \
    --cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org \
    --cc=swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).