diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2014-03-05 06:11:57 -0500 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-03-05 23:22:21 -0500 |
commit | 9202c377390f2708dece910f2e066a6308a38abc (patch) | |
tree | 04adda2bdba04b6f092e4fbf379b07ef2bfbd1ab /sound/soc/intel | |
parent | a6cf8f7b53fff6b5e3463793aa9885e133e7ef86 (diff) |
ASoC: Baytrail: fix error handling in sst_byt_dsp_init()
Calling "kfree(byt)" is a double free because that was allocated with
devm_kzalloc(). There were a couple places which leak "byt->msg". That
memory is allocated in msg_empty_list_init().
Fixes: f7d01fd6754c ('ASoC: Intel: Add Intel Baytrail SST DSP IPC support')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound/soc/intel')
-rw-r--r-- | sound/soc/intel/sst-baytrail-ipc.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sound/soc/intel/sst-baytrail-ipc.c b/sound/soc/intel/sst-baytrail-ipc.c index c12e194bbc6b..d0eaeee21be4 100644 --- a/sound/soc/intel/sst-baytrail-ipc.c +++ b/sound/soc/intel/sst-baytrail-ipc.c | |||
@@ -796,7 +796,7 @@ int sst_byt_dsp_init(struct device *dev, struct sst_pdata *pdata) | |||
796 | 796 | ||
797 | err = msg_empty_list_init(byt); | 797 | err = msg_empty_list_init(byt); |
798 | if (err < 0) | 798 | if (err < 0) |
799 | goto list_err; | 799 | return -ENOMEM; |
800 | 800 | ||
801 | /* start the IPC message thread */ | 801 | /* start the IPC message thread */ |
802 | init_kthread_worker(&byt->kworker); | 802 | init_kthread_worker(&byt->kworker); |
@@ -806,7 +806,7 @@ int sst_byt_dsp_init(struct device *dev, struct sst_pdata *pdata) | |||
806 | if (IS_ERR(byt->tx_thread)) { | 806 | if (IS_ERR(byt->tx_thread)) { |
807 | err = PTR_ERR(byt->tx_thread); | 807 | err = PTR_ERR(byt->tx_thread); |
808 | dev_err(byt->dev, "error failed to create message TX task\n"); | 808 | dev_err(byt->dev, "error failed to create message TX task\n"); |
809 | goto list_err; | 809 | goto err_free_msg; |
810 | } | 810 | } |
811 | init_kthread_work(&byt->kwork, sst_byt_ipc_tx_msgs); | 811 | init_kthread_work(&byt->kwork, sst_byt_ipc_tx_msgs); |
812 | 812 | ||
@@ -816,7 +816,7 @@ int sst_byt_dsp_init(struct device *dev, struct sst_pdata *pdata) | |||
816 | byt->dsp = sst_dsp_new(dev, &byt_dev, pdata); | 816 | byt->dsp = sst_dsp_new(dev, &byt_dev, pdata); |
817 | if (byt->dsp == NULL) { | 817 | if (byt->dsp == NULL) { |
818 | err = -ENODEV; | 818 | err = -ENODEV; |
819 | goto list_err; | 819 | goto err_free_msg; |
820 | } | 820 | } |
821 | 821 | ||
822 | /* keep the DSP in reset state for base FW loading */ | 822 | /* keep the DSP in reset state for base FW loading */ |
@@ -848,9 +848,9 @@ boot_err: | |||
848 | sst_fw_free(byt_sst_fw); | 848 | sst_fw_free(byt_sst_fw); |
849 | fw_err: | 849 | fw_err: |
850 | sst_dsp_free(byt->dsp); | 850 | sst_dsp_free(byt->dsp); |
851 | err_free_msg: | ||
851 | kfree(byt->msg); | 852 | kfree(byt->msg); |
852 | list_err: | 853 | |
853 | kfree(byt); | ||
854 | return err; | 854 | return err; |
855 | } | 855 | } |
856 | EXPORT_SYMBOL_GPL(sst_byt_dsp_init); | 856 | EXPORT_SYMBOL_GPL(sst_byt_dsp_init); |