Skip to content

Commit

Permalink
drivers/pcmcia/electra_cf.c: add missing iounmap and kfree
Browse files Browse the repository at this point in the history
cf and cf->mem_base have been allocated at the point of this failure, so
they should be freed before leaving the function.

[linux@dominikbrodowski.net: limit call to device_init_wakeup() to the
same error paths as before]
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
  • Loading branch information
Julia Lawall authored and Dominik Brodowski committed May 30, 2015
1 parent e632cd9 commit 801421e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions drivers/pcmcia/electra_cf.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,10 @@ static int electra_cf_probe(struct platform_device *ofdev)
cf->io_size = PAGE_ALIGN(resource_size(&io));

area = __get_vm_area(cf->io_size, 0, PHB_IO_BASE, PHB_IO_END);
if (area == NULL)
return -ENOMEM;
if (area == NULL) {
status = -ENOMEM;
goto fail1;
}

cf->io_virt = (void __iomem *)(area->addr);

Expand Down Expand Up @@ -320,7 +322,8 @@ static int electra_cf_probe(struct platform_device *ofdev)
iounmap(cf->mem_base);
if (cf->gpio_base)
iounmap(cf->gpio_base);
device_init_wakeup(&ofdev->dev, 0);
if (area)
device_init_wakeup(&ofdev->dev, 0);
kfree(cf);
return status;

Expand Down

0 comments on commit 801421e

Please sign in to comment.