aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/of
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2013-06-23 03:50:07 -0400
committerGrant Likely <grant.likely@linaro.org>2013-07-22 14:40:38 -0400
commitc0cdfaa0a5e7a346ac2f661f63f543cdc5f7cbbe (patch)
treea50fe3d27f2bcb9aa00e2c2b6e6c428e1c86618c /drivers/of
parentcfd1ee3e37360ac6ec8c737e63e70c5d583f1e51 (diff)
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 <axel.lin@ingics.com> Signed-off-by: Grant Likely <grant.likely@linaro.org>
Diffstat (limited to 'drivers/of')
-rw-r--r--drivers/of/irq.c5
1 files changed, 3 insertions, 2 deletions
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)
482 } 482 }
483 483
484 /* Get the next pending parent that might have children */ 484 /* Get the next pending parent that might have children */
485 desc = list_first_entry(&intc_parent_list, typeof(*desc), list); 485 desc = list_first_entry_or_null(&intc_parent_list,
486 if (list_empty(&intc_parent_list) || !desc) { 486 typeof(*desc), list);
487 if (!desc) {
487 pr_err("of_irq_init: children remain, but no parents\n"); 488 pr_err("of_irq_init: children remain, but no parents\n");
488 break; 489 break;
489 } 490 }