omap: mailbox: check iomem resource before dereferencing it
authorSuman Anna <s-anna@ti.com>
Sat, 2 Feb 2013 02:24:51 +0000 (20:24 -0600)
committerSuman Anna <s-anna@ti.com>
Tue, 11 Jun 2013 14:44:02 +0000 (09:44 -0500)
Add a NULL check for iomem resource in mailbox probe functions.

Signed-off-by: Fernando Guzman Lugo <lugo.fernando@gmail.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
arch/arm/mach-omap1/mailbox.c
arch/arm/mach-omap2/mailbox.c

index efc8f207f6fcd7845065b569f835764ff47e9ba5..a343d5f9a50a560c4855699de08b37ff755cd7ad 100644 (file)
@@ -152,6 +152,9 @@ static int omap1_mbox_probe(struct platform_device *pdev)
        list[0]->irq = platform_get_irq_byname(pdev, "dsp");
 
        mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       if (!mem)
+               return -ENOENT;
+
        mbox_base = ioremap(mem->start, resource_size(mem));
        if (!mbox_base)
                return -ENOMEM;
index 0b080267b7f6355dac3b9adcd8b732b7cc44f936..9fe0bf2fef33084ec8a0bc1a87fe8a22cc10a254 100644 (file)
@@ -382,6 +382,9 @@ static int omap2_mbox_probe(struct platform_device *pdev)
        }
 
        mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       if (!mem)
+               return -ENOENT;
+
        mbox_base = ioremap(mem->start, resource_size(mem));
        if (!mbox_base)
                return -ENOMEM;