diff options
author | Sylwester Nawrocki <s.nawrocki@samsung.com> | 2016-07-21 20:03:49 +0200 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2016-07-21 19:18:17 +0100 |
commit | 2b960386cb75bd332a132c44c9ec69bd1f3122d8 (patch) | |
tree | 05a20281f3b1e15b7f8bf80d25a0733d0a522cb0 /sound/soc/samsung/i2s.c | |
parent | 48b418d7fd359fe1d9845507bdbecf151e0a0dd9 (diff) | |
download | op-kernel-dev-2b960386cb75bd332a132c44c9ec69bd1f3122d8.zip op-kernel-dev-2b960386cb75bd332a132c44c9ec69bd1f3122d8.tar.gz |
ASoC: samsung: Fix error paths in the I2S driver's probe()
Ensure they secondary DAI device is freed properly when asoc_dma_platform
registration fails. This change is needed for proper deferred probe support
and will help preventing situations when the CPU DAI's initialization
completes without required DMA resources.
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/samsung/i2s.c')
-rw-r--r-- | sound/soc/samsung/i2s.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index 27ca116..2bb3550 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -1107,6 +1107,11 @@ static struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, bool sec) return i2s; } +static void i2s_free_sec_dai(struct i2s_dai *i2s) +{ + platform_device_del(i2s->pdev); +} + #ifdef CONFIG_PM static int i2s_runtime_suspend(struct device *dev) { @@ -1340,17 +1345,27 @@ static int samsung_i2s_probe(struct platform_device *pdev) return -EINVAL; } - devm_snd_soc_register_component(&pri_dai->pdev->dev, + ret = devm_snd_soc_register_component(&pri_dai->pdev->dev, &samsung_i2s_component, &pri_dai->i2s_dai_drv, 1); + if (ret < 0) + goto err_free_dai; + + ret = samsung_asoc_dma_platform_register(&pdev->dev, pri_dai->filter); + if (ret < 0) + goto err_free_dai; pm_runtime_enable(&pdev->dev); - ret = samsung_asoc_dma_platform_register(&pdev->dev, pri_dai->filter); - if (ret != 0) - return ret; + ret = i2s_register_clock_provider(pdev); + if (!ret) + return 0; - return i2s_register_clock_provider(pdev); + pm_runtime_disable(&pdev->dev); +err_free_dai: + if (sec_dai) + i2s_free_sec_dai(sec_dai); + return ret; } static int samsung_i2s_remove(struct platform_device *pdev) |