dmaengine: ste_dma40: fix error return code in d40_probe()

In many of the error handling case, the return value 'ret' not set
and 0 will be return from d40_probe() even if error, but we should
return a negative error code instead in those error handling case.
This patch fixed them, and also removed useless variable 'err'.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
Wei Yongjun 2013-05-31 09:50:07 +08:00 committed by Linus Walleij
parent 499c2bc3cc
commit 8581bbcd30

View File

@ -3535,7 +3535,6 @@ static int __init d40_probe(struct platform_device *pdev)
{ {
struct stedma40_platform_data *plat_data = pdev->dev.platform_data; struct stedma40_platform_data *plat_data = pdev->dev.platform_data;
struct device_node *np = pdev->dev.of_node; struct device_node *np = pdev->dev.of_node;
int err;
int ret = -ENOENT; int ret = -ENOENT;
struct d40_base *base = NULL; struct d40_base *base = NULL;
struct resource *res = NULL; struct resource *res = NULL;
@ -3647,6 +3646,7 @@ static int __init d40_probe(struct platform_device *pdev)
base->lcpa_regulator = regulator_get(base->dev, "lcla_esram"); base->lcpa_regulator = regulator_get(base->dev, "lcla_esram");
if (IS_ERR(base->lcpa_regulator)) { if (IS_ERR(base->lcpa_regulator)) {
d40_err(&pdev->dev, "Failed to get lcpa_regulator\n"); d40_err(&pdev->dev, "Failed to get lcpa_regulator\n");
ret = PTR_ERR(base->lcpa_regulator);
base->lcpa_regulator = NULL; base->lcpa_regulator = NULL;
goto failure; goto failure;
} }
@ -3662,13 +3662,13 @@ static int __init d40_probe(struct platform_device *pdev)
} }
base->initialized = true; base->initialized = true;
err = d40_dmaengine_init(base, num_reserved_chans); ret = d40_dmaengine_init(base, num_reserved_chans);
if (err) if (ret)
goto failure; goto failure;
base->dev->dma_parms = &base->dma_parms; base->dev->dma_parms = &base->dma_parms;
err = dma_set_max_seg_size(base->dev, STEDMA40_MAX_SEG_SIZE); ret = dma_set_max_seg_size(base->dev, STEDMA40_MAX_SEG_SIZE);
if (err) { if (ret) {
d40_err(&pdev->dev, "Failed to set dma max seg size\n"); d40_err(&pdev->dev, "Failed to set dma max seg size\n");
goto failure; goto failure;
} }
@ -3676,8 +3676,8 @@ static int __init d40_probe(struct platform_device *pdev)
d40_hw_init(base); d40_hw_init(base);
if (np) { if (np) {
err = of_dma_controller_register(np, d40_xlate, NULL); ret = of_dma_controller_register(np, d40_xlate, NULL);
if (err && err != -ENODEV) if (ret)
dev_err(&pdev->dev, dev_err(&pdev->dev,
"could not register of_dma_controller\n"); "could not register of_dma_controller\n");
} }