Skip to content

Commit

Permalink
mailbox/omap: check iomem resource before dereferencing it
Browse files Browse the repository at this point in the history
Add a NULL check for iomem resource in mailbox probe functions.

Signed-off-by: Fernando Guzman Lugo <fernando.lugo@ti.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
  • Loading branch information
sumananna committed Feb 5, 2013
1 parent f64f2b6 commit aead7df
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/mailbox/mailbox-omap1.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions drivers/mailbox/mailbox-omap2.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,11 @@ static int omap2_mbox_probe(struct platform_device *pdev)
}

mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!mem) {
ret = -ENOMEM;
goto free;
}

mbox_base = ioremap(mem->start, resource_size(mem));
if (!mbox_base) {
ret = -ENOMEM;
Expand Down

0 comments on commit aead7df

Please sign in to comment.