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 | np = of_find_compatible_node(NULL, NULL, lookup->compatible); | 98 | np = of_find_compatible_node(NULL, NULL, lookup->compatible); |
| 99 | if (np) { | 99 | if (np) { |
| 100 | lookup->name = (char *)np->name; | 100 | lookup->name = (char *)np->name; |
| 101 | if (lookup->phys_addr) | 101 | if (lookup->phys_addr) { |
| 102 | of_node_put(np); | ||
| 102 | continue; | 103 | continue; |
| 104 | } | ||
| 103 | if (!of_address_to_resource(np, 0, &res)) | 105 | if (!of_address_to_resource(np, 0, &res)) |
| 104 | lookup->phys_addr = res.start; | 106 | lookup->phys_addr = res.start; |
| 107 | of_node_put(np); | ||
| 105 | } | 108 | } |
| 106 | } | 109 | } |
| 107 | 110 | ||
| 111 | of_node_put(root); | ||
| 112 | |||
| 108 | return 0; | 113 | return 0; |
| 109 | } | 114 | } |
| 110 | 115 | ||
| @@ -32,6 +32,9 @@ static unsigned int pic32_xlate_core_timer_irq(void) · 31 unmodified lines | |||
| 32 | goto default_map; | 32 | goto default_map; |
| 33 | 33 | ||
| 34 | irq = irq_of_parse_and_map(node, 0); | 34 | irq = irq_of_parse_and_map(node, 0); |
| 35 | |||
| 36 | of_node_put(node); | ||
| 37 | |||
| 35 | if (!irq) | 38 | if (!irq) |
| 36 | goto default_map; | 39 | goto default_map; |
| 37 | 40 | ||