Commit a41677c6 authored by Suman Anna's avatar Suman Anna

omap: mailbox: check iomem resource before dereferencing it

Add a NULL check for iomem resource in mailbox probe functions.
Signed-off-by: default avatarFernando Guzman Lugo <lugo.fernando@gmail.com>
Signed-off-by: default avatarSuman Anna <s-anna@ti.com>
parent 317ddd25
...@@ -152,6 +152,9 @@ static int omap1_mbox_probe(struct platform_device *pdev) ...@@ -152,6 +152,9 @@ static int omap1_mbox_probe(struct platform_device *pdev)
list[0]->irq = platform_get_irq_byname(pdev, "dsp"); list[0]->irq = platform_get_irq_byname(pdev, "dsp");
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!mem)
return -ENOENT;
mbox_base = ioremap(mem->start, resource_size(mem)); mbox_base = ioremap(mem->start, resource_size(mem));
if (!mbox_base) if (!mbox_base)
return -ENOMEM; return -ENOMEM;
......
...@@ -382,6 +382,9 @@ static int omap2_mbox_probe(struct platform_device *pdev) ...@@ -382,6 +382,9 @@ static int omap2_mbox_probe(struct platform_device *pdev)
} }
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!mem)
return -ENOENT;
mbox_base = ioremap(mem->start, resource_size(mem)); mbox_base = ioremap(mem->start, resource_size(mem));
if (!mbox_base) if (!mbox_base)
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment