ASoc: kirkwood: simplify probe error
PATCH 2/4 ASoc: kirkwood: simplify probe error
The function kirkwood_i2s_dev_remove() may be used when probe fails.
--- sound/soc/kirkwood/kirkwood-i2s.c | 44 +++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 23 deletions(-)
sound/soc/kirkwood/kirkwood-i2s.c +21 -23
@@ -455,6 +455,21 @@ static const struct snd_soc_component_driver kirkwood_i2s_component = { .name = DRV_NAME, }; +static int kirkwood_i2s_dev_remove (struct platform_device *pdev) +{ +struct kirkwood_dma_data *priv =dev_get_drvdata (&pdev->dev); + +snd_soc_unregister_component (&pdev->dev); + +if (!IS_ERR (priv->extclk)) { +clk_disable_unprepare (priv->extclk); +clk_put (priv->extclk); + } +clk_disable_unprepare (priv->clk); + +return 0 ; +} +static int kirkwood_i2s_dev_probe (struct platform_device *pdev) {struct kirkwood_asoc_platform_data *data = pdev->dev.platform_data;
@@ -525,34 +540,17 @@ static int kirkwood_i2s_dev_probe(struct platform_device *pdev) err =snd_soc_register_component (&pdev->dev, &kirkwood_i2s_component, soc_dai,1 ); -if (!err) -return 0 ; -dev_err (&pdev->dev,"snd_soc_register_component failed\n" ); - -if (!IS_ERR (priv->extclk)) { -clk_disable_unprepare (priv->extclk); -clk_put (priv->extclk); +if (err) { +dev_err (&pdev->dev,"snd_soc_register_component failed\n" ); + goto fail; } -clk_disable_unprepare (priv->clk); +return 0 ; +fail: +kirkwood_i2s_dev_remove (pdev);return err; } -static int kirkwood_i2s_dev_remove (struct platform_device *pdev) -{ -struct kirkwood_dma_data *priv =dev_get_drvdata (&pdev->dev); - -snd_soc_unregister_component (&pdev->dev); - -if (!IS_ERR (priv->extclk)) { -clk_disable_unprepare (priv->extclk); -clk_put (priv->extclk); - } -clk_disable_unprepare (priv->clk); - -return 0 ; -} -static struct platform_driver kirkwood_i2s_driver = { .probe = kirkwood_i2s_dev_probe, .remove = kirkwood_i2s_dev_remove,
Signature · 7 lines
1.8.3.2 -- Ken ar c'hentañ | ** Breizh ha Linux atav! ** Jef | http://moinejf.free.fr/
Mark Brown
maintainerQuoted 1 line · Jean-Francois Moine
The function
kirkwood_i2s_dev_remove()may be used when probe fails.
This seems fine but doesn't apply against current code but otherwise seems fine.
sound/soc/kirkwood/kirkwood-i2s.c static const struct snd_soc_component_driver kirkwood_i2s_component = { · line 467
Quoted 4 lines
sound/soc/kirkwood/kirkwood-i2s.c +4
-0+if (!IS_ERR (priv->extclk)) { +clk_disable_unprepare (priv->extclk); +clk_put (priv->extclk); + }
Could use devm_clk_get() for extclk.
Quoted 5 lines · On Thu, 25 Jul 2013 20:10:59 +0100 Mark Brown <[email protected]> wrote:
Quoted 1 line · Jean-Francois Moine
The function
kirkwood_i2s_dev_remove()may be used when probe fails.This seems fine but doesn't apply against current code but otherwise seems fine.
My base is 3.11-rc2.
Quoted 6 lines
sound/soc/kirkwood/kirkwood-i2s.c static const struct snd_soc_component_driver kirkwood_i2s_component = { · line 467
Quoted 4 lines
sound/soc/kirkwood/kirkwood-i2s.c +4
-0+if (!IS_ERR (priv->extclk)) { +clk_disable_unprepare (priv->extclk); +clk_put (priv->extclk); + }Could use
devm_clk_get()for extclk.
I will do it.
Signature · 2 lines
Ken ar c'hentañ | ** Breizh ha Linux atav! ** Jef | http://moinejf.free.fr/
Mark Brown
maintainerQuoted 6 lines · Jean-Francois Moine
Quoted 2 lines · Mark Brown
This seems fine but doesn't apply against current code but otherwise seems fine.
My base is 3.11-rc2.
Always submit against where the code will be applied - -next in this case.