lkml.org 
[lkml]   [2013]   [Jul]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] of/irq: Avoid calling list_first_entry() for empty list
Date
On Sun, 23 Jun 2013 15:50:07 +0800, Axel Lin <axel.lin@ingics.com> 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@ingics.com>

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
>
>
>



\
 
 \ /
  Last update: 2013-07-20 14:41    [W:0.053 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site