From: Axel Lin Date: Sun, 23 Jun 2013 07:50:07 +0000 (+0800) Subject: of/irq: Avoid calling list_first_entry() for empty list X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=c0cdfaa0a5e7a346ac2f661f63f543cdc5f7cbbe;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git of/irq: Avoid calling list_first_entry() for empty list 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 Signed-off-by: Grant Likely --- diff --git a/drivers/of/irq.c b/drivers/of/irq.c index a3c1c5aae6a9..5c645c7227b8 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; }