/* In of_node_put() this function is passed to kref_put() as the destructor.  */
static void of_node_release(struct kref *kref)
/* In of_node_put() this function is passed to kref_put() as the destructor.  */
static void of_node_release(struct kref *kref)
{
	struct device_node *node = kref_to_device_node(kref);
	struct property *prop = node->properties;
	if (!of_node_check_flag(node, OF_DETACHED)) {
		printk(KERN_INFO "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);
		kfree(prop->value);
		kfree(prop);
		prop = next;
		if (!prop) {
			prop = node->deadprops;
			node->deadprops = NULL;
		}
	}
	kfree(node->full_name);
	kfree(node->data);
	kfree(node);
}