alloc via alloc_bootmem(), free via kfree()
Mike Kravetz
kravetz at us.ibm.com
Tue Aug 24 07:24:59 EST 2004
Was just looking at the routine alloc_phb(). In this routine there
is the following line:
phb = pci_alloc_pci_controller(phb_type);
In pci_alloc_pci_controller() allocation for the returned structure
is as follows:
#ifdef CONFIG_PPC_ISERIES
hose = (struct pci_controller *)kmalloc(sizeof(struct pci_controller), GFP_KERNEL);
#else
hose = (struct pci_controller *)alloc_bootmem(sizeof(struct pci_controller));
#endif
So, on pSeries we would do the allocation via alloc_bootmem().
However, a couple of error paths in alloc_phb() contain:
kfree(phb);
Looks like the error paths need to be changed so that the 'type of free'
corresponds to the type of allocation. I could provide a trivial patch
to do this, but ideally we might want to create another routine such as
pci_free_pci_controller() so that the caller doesn't need to know what
underlying allocation scheme was used. It also looks like there might
be an opportunity for cleanup in this area.
Does someone familiar with this code want to fix this? Like I said, I
could provide a trivial patch if needed.
--
Mike
** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/
More information about the Linuxppc64-dev
mailing list