of: of_free fixes
- Add missing prototype for of_free() - When root node is freed set root_node to NULL - (re)scan aliases after freeing a node. This is necessary because the freed node may be an alias or point to an alias Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
da852397e0
commit
818dccf28b
|
@ -138,6 +138,12 @@ static void of_alias_add(struct alias_prop *ap, struct device_node *np,
|
|||
void of_alias_scan(void)
|
||||
{
|
||||
struct property *pp;
|
||||
struct alias_prop *app, *tmp;
|
||||
|
||||
list_for_each_entry_safe(app, tmp, &aliases_lookup, link)
|
||||
free(app);
|
||||
|
||||
INIT_LIST_HEAD(&aliases_lookup);
|
||||
|
||||
of_aliases = of_find_node_by_path("/aliases");
|
||||
if (!of_aliases)
|
||||
|
@ -777,6 +783,11 @@ void of_free(struct device_node *node)
|
|||
free(node->name);
|
||||
free(node->full_name);
|
||||
free(node);
|
||||
|
||||
if (node == root_node)
|
||||
root_node = NULL;
|
||||
|
||||
of_alias_scan();
|
||||
}
|
||||
|
||||
static void __of_probe(struct device_node *node)
|
||||
|
|
|
@ -107,6 +107,7 @@ int of_machine_is_compatible(const char *compat);
|
|||
void of_print_nodes(struct device_node *node, int indent);
|
||||
int of_probe(void);
|
||||
int of_parse_dtb(struct fdt_header *fdt);
|
||||
void of_free(struct device_node *node);
|
||||
|
||||
int of_property_read_string(struct device_node *np, const char *propname,
|
||||
const char **out_string);
|
||||
|
|
Loading…
Reference in New Issue