powerpc: Rework ipic_init() so we can avoid freeing the irq_host
authorMichael Ellerman <michael@ellerman.id.au>
Mon, 26 May 2008 02:12:30 +0000 (12:12 +1000)
committerPaul Mackerras <paulus@samba.org>
Mon, 9 Jun 2008 03:51:14 +0000 (13:51 +1000)
If we do the call to of_address_to_resource() first, then we don't
need to worry about freeing the irq_host (which the code doesn't do
currently anyway).

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/sysdev/ipic.c

index 0f2dfb0aaa6adaa77e6e1232d1951a4fe3d7382d..f95d10ba3b9c2126cf7c9542526e290ce70c2e28 100644 (file)
@@ -725,6 +725,10 @@ struct ipic * __init ipic_init(struct device_node *node, unsigned int flags)
        struct resource res;
        u32 temp = 0, ret;
 
+       ret = of_address_to_resource(node, 0, &res);
+       if (ret)
+               return NULL;
+
        ipic = alloc_bootmem(sizeof(struct ipic));
        if (ipic == NULL)
                return NULL;
@@ -739,12 +743,6 @@ struct ipic * __init ipic_init(struct device_node *node, unsigned int flags)
                return NULL;
        }
 
-       ret = of_address_to_resource(node, 0, &res);
-       if (ret) {
-               of_node_put(node);
-               return NULL;
-       }
-
        ipic->regs = ioremap(res.start, res.end - res.start + 1);
 
        ipic->irqhost->host_data = ipic;