summaryrefslogtreecommitdiffstats
path: root/sound/soc/intel/sst-baytrail-ipc.c
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2014-03-05 14:11:57 +0300
committerMark Brown <broonie@linaro.org>2014-03-06 12:22:21 +0800
commit9202c377390f2708dece910f2e066a6308a38abc (patch)
tree04adda2bdba04b6f092e4fbf379b07ef2bfbd1ab /sound/soc/intel/sst-baytrail-ipc.c
parenta6cf8f7b53fff6b5e3463793aa9885e133e7ef86 (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/sst-baytrail-ipc.c')
-rw-r--r--sound/soc/intel/sst-baytrail-ipc.c10
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 c12e194bbc6..d0eaeee21be 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)
err = msg_empty_list_init(byt);
if (err < 0)
- goto list_err;
+ return -ENOMEM;
/* start the IPC message thread */
init_kthread_worker(&byt->kworker);
@@ -806,7 +806,7 @@ int sst_byt_dsp_init(struct device *dev, struct sst_pdata *pdata)
if (IS_ERR(byt->tx_thread)) {
err = PTR_ERR(byt->tx_thread);
dev_err(byt->dev, "error failed to create message TX task\n");
- goto list_err;
+ goto err_free_msg;
}
init_kthread_work(&byt->kwork, sst_byt_ipc_tx_msgs);
@@ -816,7 +816,7 @@ int sst_byt_dsp_init(struct device *dev, struct sst_pdata *pdata)
byt->dsp = sst_dsp_new(dev, &byt_dev, pdata);
if (byt->dsp == NULL) {
err = -ENODEV;
- goto list_err;
+ goto err_free_msg;
}
/* keep the DSP in reset state for base FW loading */
@@ -848,9 +848,9 @@ boot_err:
sst_fw_free(byt_sst_fw);
fw_err:
sst_dsp_free(byt->dsp);
+err_free_msg:
kfree(byt->msg);
-list_err:
- kfree(byt);
+
return err;
}
EXPORT_SYMBOL_GPL(sst_byt_dsp_init);