Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 60684
b: refs/heads/master
c: 6a28185
h: refs/heads/master
v: v3
  • Loading branch information
Michael Ellerman authored and Paul Mackerras committed Jul 10, 2007
1 parent 249d51d commit e52b207
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d3b814bb1e8b0c63449a3430196c20cbe24a3e67
refs/heads/master: 6a281856c02d2291df2f7d9df5bfdee2e7bdd747
11 changes: 11 additions & 0 deletions trunk/arch/powerpc/kernel/prom.c
Original file line number Diff line number Diff line change
Expand Up @@ -1375,8 +1375,17 @@ static void of_node_release(struct kref *kref)
struct device_node *node = kref_to_device_node(kref);
struct property *prop = node->properties;

/* We should never be releasing nodes that haven't been detached. */
if (!of_node_check_flag(node, OF_DETACHED)) {
printk("WARNING: Bad of_node_put() on %s\n", node->full_name);
dump_stack();
kref_init(&node->kref);
return;
}

if (!of_node_check_flag(node, OF_DYNAMIC))
return;

while (prop) {
struct property *next = prop->next;
kfree(prop->name);
Expand Down Expand Up @@ -1457,6 +1466,8 @@ void of_detach_node(const struct device_node *np)
prevsib->sibling = np->sibling;
}

of_node_set_flag(np, OF_DETACHED);

out_unlock:
write_unlock(&devtree_lock);
}
Expand Down
1 change: 1 addition & 0 deletions trunk/include/asm-powerpc/prom.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ extern struct device_node *of_chosen;

/* flag descriptions */
#define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */
#define OF_DETACHED 2 /* node has been detached from the device tree */

static inline int of_node_check_flag(struct device_node *n, unsigned long flag)
{
Expand Down

0 comments on commit e52b207

Please sign in to comment.