summaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorSylwester Nawrocki <s.nawrocki@samsung.com>2016-07-21 14:03:49 -0400
committerMark Brown <broonie@kernel.org>2016-07-21 14:18:17 -0400
commit2b960386cb75bd332a132c44c9ec69bd1f3122d8 (patch)
tree05a20281f3b1e15b7f8bf80d25a0733d0a522cb0 /sound
parent48b418d7fd359fe1d9845507bdbecf151e0a0dd9 (diff)
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')
-rw-r--r--sound/soc/samsung/i2s.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
index 27ca116ef31f..2bb35502b070 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)
1107 return i2s; 1107 return i2s;
1108} 1108}
1109 1109
1110static void i2s_free_sec_dai(struct i2s_dai *i2s)
1111{
1112 platform_device_del(i2s->pdev);
1113}
1114
1110#ifdef CONFIG_PM 1115#ifdef CONFIG_PM
1111static int i2s_runtime_suspend(struct device *dev) 1116static int i2s_runtime_suspend(struct device *dev)
1112{ 1117{
@@ -1340,17 +1345,27 @@ static int samsung_i2s_probe(struct platform_device *pdev)
1340 return -EINVAL; 1345 return -EINVAL;
1341 } 1346 }
1342 1347
1343 devm_snd_soc_register_component(&pri_dai->pdev->dev, 1348 ret = devm_snd_soc_register_component(&pri_dai->pdev->dev,
1344 &samsung_i2s_component, 1349 &samsung_i2s_component,
1345 &pri_dai->i2s_dai_drv, 1); 1350 &pri_dai->i2s_dai_drv, 1);
1351 if (ret < 0)
1352 goto err_free_dai;
1353
1354 ret = samsung_asoc_dma_platform_register(&pdev->dev, pri_dai->filter);
1355 if (ret < 0)
1356 goto err_free_dai;
1346 1357
1347 pm_runtime_enable(&pdev->dev); 1358 pm_runtime_enable(&pdev->dev);
1348 1359
1349 ret = samsung_asoc_dma_platform_register(&pdev->dev, pri_dai->filter); 1360 ret = i2s_register_clock_provider(pdev);
1350 if (ret != 0) 1361 if (!ret)
1351 return ret; 1362 return 0;
1352 1363
1353 return i2s_register_clock_provider(pdev); 1364 pm_runtime_disable(&pdev->dev);
1365err_free_dai:
1366 if (sec_dai)
1367 i2s_free_sec_dai(sec_dai);
1368 return ret;
1354} 1369}
1355 1370
1356static int samsung_i2s_remove(struct platform_device *pdev) 1371static int samsung_i2s_remove(struct platform_device *pdev)