From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx> Date: Sun, 18 Jan 2015 19:45:45 +0100 The functions "iounmap", "kfree" and "release_mem_region" were called in some cases by the bcm63xx_drv_pcmcia_probe() function during error handling even if the passed variable contained a null pointer. * Corresponding details could be improved by adjustments for jump labels. * Let us delete also another unnecessary check for the data structure member "reg_res" there. Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx> --- drivers/pcmcia/bcm63xx_pcmcia.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/pcmcia/bcm63xx_pcmcia.c b/drivers/pcmcia/bcm63xx_pcmcia.c index 9e7ad1b..9848d91a2 100644 --- a/drivers/pcmcia/bcm63xx_pcmcia.c +++ b/drivers/pcmcia/bcm63xx_pcmcia.c @@ -346,7 +346,7 @@ static int bcm63xx_drv_pcmcia_probe(struct platform_device *pdev) skt->pd = pdev->dev.platform_data; if (!skt->common_res || !skt->attr_res || !irq_res || !skt->pd) { ret = -EINVAL; - goto err; + goto free_memory; } /* remap pcmcia registers */ @@ -354,14 +354,14 @@ static int bcm63xx_drv_pcmcia_probe(struct platform_device *pdev) regmem_size = resource_size(res); if (!request_mem_region(res->start, regmem_size, "bcm63xx_pcmcia")) { ret = -EINVAL; - goto err; + goto free_memory; } skt->reg_res = res; skt->base = ioremap(res->start, regmem_size); if (!skt->base) { ret = -ENOMEM; - goto err; + goto release_memory_region; } /* remap io registers */ @@ -370,7 +370,7 @@ static int bcm63xx_drv_pcmcia_probe(struct platform_device *pdev) skt->io_base = ioremap(res->start, iomem_size); if (!skt->io_base) { ret = -ENOMEM; - goto err; + goto io_unmap_base; } /* resources are static */ @@ -427,9 +427,11 @@ static int bcm63xx_drv_pcmcia_probe(struct platform_device *pdev) err: iounmap(skt->io_base); +io_unmap_base: iounmap(skt->base); - if (skt->reg_res) - release_mem_region(skt->reg_res->start, regmem_size); +release_memory_region: + release_mem_region(skt->reg_res->start, regmem_size); +free_memory: kfree(skt); return ret; } -- 2.2.2 -- To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html