omap: mailbox: check iomem resource before dereferencing it
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>
This commit is contained in:
parent
317ddd256b
commit
a41677c6c5
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue