提交 c0cdfaa0 编写于 作者: A Axel Lin 提交者: Grant Likely

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: NAxel Lin <axel.lin@ingics.com>
Signed-off-by: NGrant Likely <grant.likely@linaro.org>
上级 cfd1ee3e
...@@ -482,8 +482,9 @@ void __init of_irq_init(const struct of_device_id *matches) ...@@ -482,8 +482,9 @@ void __init of_irq_init(const struct of_device_id *matches)
} }
/* Get the next pending parent that might have children */ /* Get the next pending parent that might have children */
desc = list_first_entry(&intc_parent_list, typeof(*desc), list); desc = list_first_entry_or_null(&intc_parent_list,
if (list_empty(&intc_parent_list) || !desc) { typeof(*desc), list);
if (!desc) {
pr_err("of_irq_init: children remain, but no parents\n"); pr_err("of_irq_init: children remain, but no parents\n");
break; break;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册