]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
mailbox/omap: 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>
Thu, 14 Mar 2013 18:15:12 +0000 (13:15 -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>
drivers/mailbox/mailbox-omap1.c
drivers/mailbox/mailbox-omap2.c

index 7b301579afbbe0918e9cc7b604b3e5235c3dfff4..44418726d23db6222e910fcb35ddde3a10f4f4de 100644 (file)
@@ -179,6 +179,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 -ENOMEM;
+
        mbox_base = ioremap(mem->start, resource_size(mem));
        if (!mbox_base)
                return -ENOMEM;
index 72f83684294094fdf002a4c0c06029de8c155830..eed5a3d6910f43a272e6b304b41551c161482b48 100644 (file)
@@ -296,6 +296,11 @@ static int omap2_mbox_probe(struct platform_device *pdev)
        }
 
        mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       if (!mem) {
+               ret = -ENOMEM;
+               goto free_privblk;
+       }
+
        mbox_base = ioremap(mem->start, resource_size(mem));
        if (!mbox_base) {
                ret = -ENOMEM;