base-files: define yes/no as valid boolean options
[openwrt.git] / target / linux / mvebu / patches-3.10 / 0177-of-irq-Avoid-calling-list_first_entry-for-empty-list.patch
1 From f159ea8ab3bce09a098d0d56c9e8909f385b87aa Mon Sep 17 00:00:00 2001
2 From: Axel Lin <axel.lin@ingics.com>
3 Date: Thu, 19 Dec 2013 09:30:48 -0300
4 Subject: [PATCH 177/203] of/irq: Avoid calling list_first_entry() for empty
5  list
6
7 list_first_entry() expects the list is not empty, we need to check if list is
8 empty before calling list_first_entry(). Thus use list_first_entry_or_null()
9 instead of list_first_entry().
10
11 Signed-off-by: Axel Lin <axel.lin@ingics.com>
12 Signed-off-by: Grant Likely <grant.likely@linaro.org>
13 ---
14  drivers/of/irq.c | 5 +++--
15  1 file changed, 3 insertions(+), 2 deletions(-)
16
17 --- a/drivers/of/irq.c
18 +++ b/drivers/of/irq.c
19 @@ -488,8 +488,9 @@ void __init of_irq_init(const struct of_
20                 }
21  
22                 /* Get the next pending parent that might have children */
23 -               desc = list_first_entry(&intc_parent_list, typeof(*desc), list);
24 -               if (list_empty(&intc_parent_list) || !desc) {
25 +               desc = list_first_entry_or_null(&intc_parent_list,
26 +                                               typeof(*desc), list);
27 +               if (!desc) {
28                         pr_err("of_irq_init: children remain, but no parents\n");
29                         break;
30                 }