aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Elfring <elfring@users.sourceforge.net>2015-11-16 15:56:07 -0500
committerVinod Koul <vinod.koul@intel.com>2015-12-09 22:47:05 -0500
commita9bae06dd05fc8262e7430b2e70ebc49d3e68488 (patch)
treeff9f13623c51dea29e06442af4fa6ceb37056fd5
parente0f8c58003de9691a2cf4569aaa65361587dbc1e (diff)
ste_dma40: Delete another unnecessary check in d40_probe()
A single jump label was used by the d40_probe() function in several cases for error handling which was a bit inefficient here. * This implementation detail could be improved by the introduction of another jump label. * Remove an extra check for the variable "base". * Omit its explicit initialisation at the beginning then. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
-rw-r--r--drivers/dma/ste_dma40.c82
1 files changed, 40 insertions, 42 deletions
diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
index 9132ae03f783..8ebfde12399a 100644
--- a/drivers/dma/ste_dma40.c
+++ b/drivers/dma/ste_dma40.c
@@ -3543,7 +3543,7 @@ static int __init d40_probe(struct platform_device *pdev)
3543 struct stedma40_platform_data *plat_data = dev_get_platdata(&pdev->dev); 3543 struct stedma40_platform_data *plat_data = dev_get_platdata(&pdev->dev);
3544 struct device_node *np = pdev->dev.of_node; 3544 struct device_node *np = pdev->dev.of_node;
3545 int ret = -ENOENT; 3545 int ret = -ENOENT;
3546 struct d40_base *base = NULL; 3546 struct d40_base *base;
3547 struct resource *res = NULL; 3547 struct resource *res = NULL;
3548 int num_reserved_chans; 3548 int num_reserved_chans;
3549 u32 val; 3549 u32 val;
@@ -3552,17 +3552,17 @@ static int __init d40_probe(struct platform_device *pdev)
3552 if (np) { 3552 if (np) {
3553 if (d40_of_probe(pdev, np)) { 3553 if (d40_of_probe(pdev, np)) {
3554 ret = -ENOMEM; 3554 ret = -ENOMEM;
3555 goto failure; 3555 goto report_failure;
3556 } 3556 }
3557 } else { 3557 } else {
3558 d40_err(&pdev->dev, "No pdata or Device Tree provided\n"); 3558 d40_err(&pdev->dev, "No pdata or Device Tree provided\n");
3559 goto failure; 3559 goto report_failure;
3560 } 3560 }
3561 } 3561 }
3562 3562
3563 base = d40_hw_detect_init(pdev); 3563 base = d40_hw_detect_init(pdev);
3564 if (!base) 3564 if (!base)
3565 goto failure; 3565 goto report_failure;
3566 3566
3567 num_reserved_chans = d40_phy_res_init(base); 3567 num_reserved_chans = d40_phy_res_init(base);
3568 3568
@@ -3693,50 +3693,48 @@ static int __init d40_probe(struct platform_device *pdev)
3693 return 0; 3693 return 0;
3694 3694
3695failure: 3695failure:
3696 if (base) { 3696 kmem_cache_destroy(base->desc_slab);
3697 kmem_cache_destroy(base->desc_slab); 3697 if (base->virtbase)
3698 if (base->virtbase) 3698 iounmap(base->virtbase);
3699 iounmap(base->virtbase);
3700 3699
3701 if (base->lcla_pool.base && base->plat_data->use_esram_lcla) { 3700 if (base->lcla_pool.base && base->plat_data->use_esram_lcla) {
3702 iounmap(base->lcla_pool.base); 3701 iounmap(base->lcla_pool.base);
3703 base->lcla_pool.base = NULL; 3702 base->lcla_pool.base = NULL;
3704 } 3703 }
3705 3704
3706 if (base->lcla_pool.dma_addr) 3705 if (base->lcla_pool.dma_addr)
3707 dma_unmap_single(base->dev, base->lcla_pool.dma_addr, 3706 dma_unmap_single(base->dev, base->lcla_pool.dma_addr,
3708 SZ_1K * base->num_phy_chans, 3707 SZ_1K * base->num_phy_chans,
3709 DMA_TO_DEVICE); 3708 DMA_TO_DEVICE);
3710
3711 if (!base->lcla_pool.base_unaligned && base->lcla_pool.base)
3712 free_pages((unsigned long)base->lcla_pool.base,
3713 base->lcla_pool.pages);
3714
3715 kfree(base->lcla_pool.base_unaligned);
3716
3717 if (base->phy_lcpa)
3718 release_mem_region(base->phy_lcpa,
3719 base->lcpa_size);
3720 if (base->phy_start)
3721 release_mem_region(base->phy_start,
3722 base->phy_size);
3723 if (base->clk) {
3724 clk_disable_unprepare(base->clk);
3725 clk_put(base->clk);
3726 }
3727 3709
3728 if (base->lcpa_regulator) { 3710 if (!base->lcla_pool.base_unaligned && base->lcla_pool.base)
3729 regulator_disable(base->lcpa_regulator); 3711 free_pages((unsigned long)base->lcla_pool.base,
3730 regulator_put(base->lcpa_regulator); 3712 base->lcla_pool.pages);
3731 }
3732 3713
3733 kfree(base->lcla_pool.alloc_map); 3714 kfree(base->lcla_pool.base_unaligned);
3734 kfree(base->lookup_log_chans); 3715
3735 kfree(base->lookup_phy_chans); 3716 if (base->phy_lcpa)
3736 kfree(base->phy_res); 3717 release_mem_region(base->phy_lcpa,
3737 kfree(base); 3718 base->lcpa_size);
3719 if (base->phy_start)
3720 release_mem_region(base->phy_start,
3721 base->phy_size);
3722 if (base->clk) {
3723 clk_disable_unprepare(base->clk);
3724 clk_put(base->clk);
3725 }
3726
3727 if (base->lcpa_regulator) {
3728 regulator_disable(base->lcpa_regulator);
3729 regulator_put(base->lcpa_regulator);
3738 } 3730 }
3739 3731
3732 kfree(base->lcla_pool.alloc_map);
3733 kfree(base->lookup_log_chans);
3734 kfree(base->lookup_phy_chans);
3735 kfree(base->phy_res);
3736 kfree(base);
3737report_failure:
3740 d40_err(&pdev->dev, "probe failed\n"); 3738 d40_err(&pdev->dev, "probe failed\n");
3741 return ret; 3739 return ret;
3742} 3740}