Commit a9bae06d authored by Markus Elfring's avatar Markus Elfring Committed by Vinod Koul

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: default avatarMarkus Elfring <elfring@users.sourceforge.net>
Acked-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarVinod Koul <vinod.koul@intel.com>
parent e0f8c580
...@@ -3543,7 +3543,7 @@ static int __init d40_probe(struct platform_device *pdev) ...@@ -3543,7 +3543,7 @@ static int __init d40_probe(struct platform_device *pdev)
struct stedma40_platform_data *plat_data = dev_get_platdata(&pdev->dev); struct stedma40_platform_data *plat_data = dev_get_platdata(&pdev->dev);
struct device_node *np = pdev->dev.of_node; struct device_node *np = pdev->dev.of_node;
int ret = -ENOENT; int ret = -ENOENT;
struct d40_base *base = NULL; struct d40_base *base;
struct resource *res = NULL; struct resource *res = NULL;
int num_reserved_chans; int num_reserved_chans;
u32 val; u32 val;
...@@ -3552,17 +3552,17 @@ static int __init d40_probe(struct platform_device *pdev) ...@@ -3552,17 +3552,17 @@ static int __init d40_probe(struct platform_device *pdev)
if (np) { if (np) {
if (d40_of_probe(pdev, np)) { if (d40_of_probe(pdev, np)) {
ret = -ENOMEM; ret = -ENOMEM;
goto failure; goto report_failure;
} }
} else { } else {
d40_err(&pdev->dev, "No pdata or Device Tree provided\n"); d40_err(&pdev->dev, "No pdata or Device Tree provided\n");
goto failure; goto report_failure;
} }
} }
base = d40_hw_detect_init(pdev); base = d40_hw_detect_init(pdev);
if (!base) if (!base)
goto failure; goto report_failure;
num_reserved_chans = d40_phy_res_init(base); num_reserved_chans = d40_phy_res_init(base);
...@@ -3693,7 +3693,6 @@ static int __init d40_probe(struct platform_device *pdev) ...@@ -3693,7 +3693,6 @@ static int __init d40_probe(struct platform_device *pdev)
return 0; return 0;
failure: failure:
if (base) {
kmem_cache_destroy(base->desc_slab); kmem_cache_destroy(base->desc_slab);
if (base->virtbase) if (base->virtbase)
iounmap(base->virtbase); iounmap(base->virtbase);
...@@ -3735,8 +3734,7 @@ static int __init d40_probe(struct platform_device *pdev) ...@@ -3735,8 +3734,7 @@ static int __init d40_probe(struct platform_device *pdev)
kfree(base->lookup_phy_chans); kfree(base->lookup_phy_chans);
kfree(base->phy_res); kfree(base->phy_res);
kfree(base); kfree(base);
} report_failure:
d40_err(&pdev->dev, "probe failed\n"); d40_err(&pdev->dev, "probe failed\n");
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment