diff options
author | Imre Deak <imre.deak@intel.com> | 2014-05-30 03:52:29 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-06-01 06:44:49 -0400 |
commit | 9cf0e4520d45d5425f3a5257d346e3310e1a63b4 (patch) | |
tree | c945bd6203f272bdd44a23878370ec0a62d6be3a /sound | |
parent | 9b351d46893e827940e2e8da04f1791e8ec452ca (diff) |
ASoC: Intel: byt/hsw: Add missing kthread_stop to error/cleanup path
Baytrail and Haswell SST IPC don't stop the kernel thread in error and
cleanup path thus leaving orphan kernel thread behind in such a case.
Also while at it, fix one error path in sst-haswell-ipc.c that doesn't free
hsw->msg.
[Jarkko: I edited the commit log a little]
Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/intel/sst-baytrail-ipc.c | 5 | ||||
-rw-r--r-- | sound/soc/intel/sst-haswell-ipc.c | 12 |
2 files changed, 12 insertions, 5 deletions
diff --git a/sound/soc/intel/sst-baytrail-ipc.c b/sound/soc/intel/sst-baytrail-ipc.c index 18273d26718a..40a25fce0faa 100644 --- a/sound/soc/intel/sst-baytrail-ipc.c +++ b/sound/soc/intel/sst-baytrail-ipc.c | |||
@@ -907,7 +907,7 @@ int sst_byt_dsp_init(struct device *dev, struct sst_pdata *pdata) | |||
907 | byt->dsp = sst_dsp_new(dev, &byt_dev, pdata); | 907 | byt->dsp = sst_dsp_new(dev, &byt_dev, pdata); |
908 | if (byt->dsp == NULL) { | 908 | if (byt->dsp == NULL) { |
909 | err = -ENODEV; | 909 | err = -ENODEV; |
910 | goto err_free_msg; | 910 | goto dsp_err; |
911 | } | 911 | } |
912 | 912 | ||
913 | /* keep the DSP in reset state for base FW loading */ | 913 | /* keep the DSP in reset state for base FW loading */ |
@@ -940,6 +940,8 @@ boot_err: | |||
940 | sst_fw_free(byt_sst_fw); | 940 | sst_fw_free(byt_sst_fw); |
941 | fw_err: | 941 | fw_err: |
942 | sst_dsp_free(byt->dsp); | 942 | sst_dsp_free(byt->dsp); |
943 | dsp_err: | ||
944 | kthread_stop(byt->tx_thread); | ||
943 | err_free_msg: | 945 | err_free_msg: |
944 | kfree(byt->msg); | 946 | kfree(byt->msg); |
945 | 947 | ||
@@ -954,6 +956,7 @@ void sst_byt_dsp_free(struct device *dev, struct sst_pdata *pdata) | |||
954 | sst_dsp_reset(byt->dsp); | 956 | sst_dsp_reset(byt->dsp); |
955 | sst_fw_free_all(byt->dsp); | 957 | sst_fw_free_all(byt->dsp); |
956 | sst_dsp_free(byt->dsp); | 958 | sst_dsp_free(byt->dsp); |
959 | kthread_stop(byt->tx_thread); | ||
957 | kfree(byt->msg); | 960 | kfree(byt->msg); |
958 | } | 961 | } |
959 | EXPORT_SYMBOL_GPL(sst_byt_dsp_free); | 962 | EXPORT_SYMBOL_GPL(sst_byt_dsp_free); |
diff --git a/sound/soc/intel/sst-haswell-ipc.c b/sound/soc/intel/sst-haswell-ipc.c index a8fd60c67341..b6c14a39b0b1 100644 --- a/sound/soc/intel/sst-haswell-ipc.c +++ b/sound/soc/intel/sst-haswell-ipc.c | |||
@@ -1730,7 +1730,7 @@ int sst_hsw_dsp_init(struct device *dev, struct sst_pdata *pdata) | |||
1730 | 1730 | ||
1731 | ret = msg_empty_list_init(hsw); | 1731 | ret = msg_empty_list_init(hsw); |
1732 | if (ret < 0) | 1732 | if (ret < 0) |
1733 | goto list_err; | 1733 | return -ENOMEM; |
1734 | 1734 | ||
1735 | /* start the IPC message thread */ | 1735 | /* start the IPC message thread */ |
1736 | init_kthread_worker(&hsw->kworker); | 1736 | init_kthread_worker(&hsw->kworker); |
@@ -1740,7 +1740,7 @@ int sst_hsw_dsp_init(struct device *dev, struct sst_pdata *pdata) | |||
1740 | if (IS_ERR(hsw->tx_thread)) { | 1740 | if (IS_ERR(hsw->tx_thread)) { |
1741 | ret = PTR_ERR(hsw->tx_thread); | 1741 | ret = PTR_ERR(hsw->tx_thread); |
1742 | dev_err(hsw->dev, "error: failed to create message TX task\n"); | 1742 | dev_err(hsw->dev, "error: failed to create message TX task\n"); |
1743 | goto list_err; | 1743 | goto err_free_msg; |
1744 | } | 1744 | } |
1745 | init_kthread_work(&hsw->kwork, ipc_tx_msgs); | 1745 | init_kthread_work(&hsw->kwork, ipc_tx_msgs); |
1746 | 1746 | ||
@@ -1750,7 +1750,7 @@ int sst_hsw_dsp_init(struct device *dev, struct sst_pdata *pdata) | |||
1750 | hsw->dsp = sst_dsp_new(dev, &hsw_dev, pdata); | 1750 | hsw->dsp = sst_dsp_new(dev, &hsw_dev, pdata); |
1751 | if (hsw->dsp == NULL) { | 1751 | if (hsw->dsp == NULL) { |
1752 | ret = -ENODEV; | 1752 | ret = -ENODEV; |
1753 | goto list_err; | 1753 | goto dsp_err; |
1754 | } | 1754 | } |
1755 | 1755 | ||
1756 | /* keep the DSP in reset state for base FW loading */ | 1756 | /* keep the DSP in reset state for base FW loading */ |
@@ -1794,8 +1794,11 @@ boot_err: | |||
1794 | sst_fw_free(hsw_sst_fw); | 1794 | sst_fw_free(hsw_sst_fw); |
1795 | fw_err: | 1795 | fw_err: |
1796 | sst_dsp_free(hsw->dsp); | 1796 | sst_dsp_free(hsw->dsp); |
1797 | dsp_err: | ||
1798 | kthread_stop(hsw->tx_thread); | ||
1799 | err_free_msg: | ||
1797 | kfree(hsw->msg); | 1800 | kfree(hsw->msg); |
1798 | list_err: | 1801 | |
1799 | return ret; | 1802 | return ret; |
1800 | } | 1803 | } |
1801 | EXPORT_SYMBOL_GPL(sst_hsw_dsp_init); | 1804 | EXPORT_SYMBOL_GPL(sst_hsw_dsp_init); |
@@ -1808,6 +1811,7 @@ void sst_hsw_dsp_free(struct device *dev, struct sst_pdata *pdata) | |||
1808 | sst_fw_free_all(hsw->dsp); | 1811 | sst_fw_free_all(hsw->dsp); |
1809 | sst_dsp_free(hsw->dsp); | 1812 | sst_dsp_free(hsw->dsp); |
1810 | kfree(hsw->scratch); | 1813 | kfree(hsw->scratch); |
1814 | kthread_stop(hsw->tx_thread); | ||
1811 | kfree(hsw->msg); | 1815 | kfree(hsw->msg); |
1812 | } | 1816 | } |
1813 | EXPORT_SYMBOL_GPL(sst_hsw_dsp_free); | 1817 | EXPORT_SYMBOL_GPL(sst_hsw_dsp_free); |