of_find_matching_node(), of_find_compatible_node() and of_find_node_by_path() will return node pointers with refcout incremented. We should call of_node_put() when they are not used anymore.
Unified · Split
| @@ -98,13 +98,18 @@ static int __init pic32_of_prepare_platform_data(struct of_dev_auxdata *lookup) · 97 unmodified lines | ||
| 98 | 98 | np = of_find_compatible_node(NULL, NULL, lookup->compatible); |
| 99 | 99 | if (np) { |
| 100 | 100 | lookup->name = (char *)np->name; |
| 101 | − if (lookup->phys_addr) | |
| 101 | + if (lookup->phys_addr) { | |
| 102 | + of_node_put(np); | |
| 102 | 103 | continue; |
| 104 | + } | |
| 103 | 105 | if (!of_address_to_resource(np, 0, &res)) |
| 104 | 106 | lookup->phys_addr = res.start; |
| 107 | + of_node_put(np); | |
| 105 | 108 | } |
| 106 | 109 | } |
| 107 | 110 | |
| 111 | + of_node_put(root); | |
| 112 | + | |
| 108 | 113 | return 0; |
| 109 | 114 | } |
| 110 | 115 | |
| @@ -32,6 +32,9 @@ static unsigned int pic32_xlate_core_timer_irq(void) · 31 unmodified lines | ||
| 32 | 32 | goto default_map; |
| 33 | 33 | |
| 34 | 34 | irq = irq_of_parse_and_map(node, 0); |
| 35 | + | |
| 36 | + of_node_put(node); | |
| 37 | + | |
| 35 | 38 | if (!irq) |
| 36 | 39 | goto default_map; |
| 37 | 40 | |