irqchip/gic: Don't initialise chip if mapping IO space fails
authorJon Hunter <jonathanh@nvidia.com>
Tue, 10 May 2016 15:14:40 +0000 (16:14 +0100)
committerMarc Zyngier <marc.zyngier@arm.com>
Wed, 11 May 2016 09:12:42 +0000 (10:12 +0100)
If we fail to map the address space for the GIC distributor or CPU
interface, then don't attempt to initialise the chip, just WARN and
return.

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
drivers/irqchip/irq-gic.c

index 5c4da5808b1555985e635ff078049e669346245f..612a3584a282d10aa0f24574c7f1fdcdf1ac9e37 100644 (file)
@@ -1209,10 +1209,14 @@ gic_of_init(struct device_node *node, struct device_node *parent)
                return -ENODEV;
 
        dist_base = of_iomap(node, 0);
-       WARN(!dist_base, "unable to map gic dist registers\n");
+       if (WARN(!dist_base, "unable to map gic dist registers\n"))
+               return -ENOMEM;
 
        cpu_base = of_iomap(node, 1);
-       WARN(!cpu_base, "unable to map gic cpu registers\n");
+       if (WARN(!cpu_base, "unable to map gic cpu registers\n")) {
+               iounmap(dist_base);
+               return -ENOMEM;
+       }
 
        /*
         * Disable split EOI/Deactivate if either HYP is not available