[PATCH] Separate pci bits out of struct device_node

Paul Mackerras paulus at samba.org
Tue Sep 6 14:31:58 EST 2005


Nathan Lynch writes:

> I don't see in the patch where the pci_dn is freed when its
> device_node goes away.
> 
> Should the lifetime of a pci_dn be tied to its corresponding
> device_node?

Yes... something like the (additional) patch below should do it.

> Should code which accesses a pci_dn hold a reference to its
> corresponding device_node?

Well, you can only get to a pci_dn via a device_node, and nothing
keeps long-lived references to a pci_dn, so I don't think I have
changed the situation at all.  The reference to the device_node from
the pci_dev and pci_bus are already refcounted IIRC.

Regards,
Paul.

diff -urN linux-2.6/arch/ppc64/kernel/prom.c pcidn/arch/ppc64/kernel/prom.c
--- linux-2.6/arch/ppc64/kernel/prom.c	2005-08-30 11:43:32.000000000 +1000
+++ pcidn/arch/ppc64/kernel/prom.c	2005-09-06 14:23:49.000000000 +1000
@@ -1734,6 +1734,8 @@
 	kfree(node->intrs);
 	kfree(node->addrs);
 	kfree(node->full_name);
+	if (node->data)
+		kfree(node->data);
 	kfree(node);
 }
 



More information about the Linuxppc64-dev mailing list