Skip to content

Commit

Permalink
ASoC: davinci-mcasp: Convert to use devm_snd_soc_register_component()
Browse files Browse the repository at this point in the history
It allows to remove code from the cleanup paths.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
  • Loading branch information
Peter Ujfalusi authored and Mark Brown committed Apr 22, 2014
1 parent 70e7a02 commit b6bb370
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions sound/soc/davinci/davinci-mcasp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1134,7 +1134,7 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
if (!mcasp->base) {
dev_err(&pdev->dev, "ioremap failed\n");
ret = -ENOMEM;
goto err_release_clk;
goto err;
}

mcasp->op_mode = pdata->op_mode;
Expand Down Expand Up @@ -1215,11 +1215,12 @@ static int davinci_mcasp_probe(struct platform_device *pdev)

mcasp_reparent_fck(pdev);

ret = snd_soc_register_component(&pdev->dev, &davinci_mcasp_component,
&davinci_mcasp_dai[pdata->op_mode], 1);
ret = devm_snd_soc_register_component(&pdev->dev,
&davinci_mcasp_component,
&davinci_mcasp_dai[pdata->op_mode], 1);

if (ret != 0)
goto err_release_clk;
goto err;

switch (mcasp->version) {
case MCASP_VERSION_1:
Expand All @@ -1239,23 +1240,19 @@ static int davinci_mcasp_probe(struct platform_device *pdev)

if (ret) {
dev_err(&pdev->dev, "register PCM failed: %d\n", ret);
goto err_unregister_component;
goto err;
}

return 0;

err_unregister_component:
snd_soc_unregister_component(&pdev->dev);
err_release_clk:
err:
pm_runtime_put_sync(&pdev->dev);
pm_runtime_disable(&pdev->dev);
return ret;
}

static int davinci_mcasp_remove(struct platform_device *pdev)
{
snd_soc_unregister_component(&pdev->dev);

pm_runtime_put_sync(&pdev->dev);
pm_runtime_disable(&pdev->dev);

Expand Down

0 comments on commit b6bb370

Please sign in to comment.