[PATCH 1/2] Add irq_free_host() to free an irq_host

Michael Ellerman michael at ellerman.id.au
Thu May 15 17:00:37 EST 2008


On Wed, 2008-05-14 at 23:55 -0700, Benjamin Herrenschmidt wrote:
> On Thu, 2008-05-08 at 14:23 +1000, Michael Ellerman wrote:
> > +void irq_free_host(struct irq_host *host)
> > +{
> > +       /* If it's still very early in boot we can't free, oh well. */
> > +       if (mem_init_done)
> > +               kfree(host);
> > +}
> 
> Hrm... that means that a host that was allocated before mem_init_done
> and freed later will call kfree on memory obtained from bootmem... no
> good.

God damn mem_init_done crap .. gah you're right.

> In which case do we need to free and irq host other than failure in
> irq_alloc_host ?

Well most code either doesn't check the return value, or panics. There's
two callers at the moment (after my patch) of irq_free_host(),
axon_msi.c and ipic.c - they both call free from the same function as
alloc so they're safe.

We could just do the free in irq_alloc_host()'s error path and have
irq_free_host() not actually free anything, just drop the reference
count. What a mess.

cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20080515/823ea740/attachment.pgp>


More information about the Linuxppc-dev mailing list