aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/intel/haswell
diff options
context:
space:
mode:
authorJie Yang <yang.jie@intel.com>2015-05-30 22:33:58 +0800
committerMark Brown <broonie@kernel.org>2015-06-02 15:34:11 +0100
commit2dbc80caf7e93c3d49787cf939fc416873125c1b (patch)
tree96415a9dad4b9266e7bd61e7b778dc79e51fc56e /sound/soc/intel/haswell
parentASoC: intel: Revert "ASoC: Intel: fix broadwell module removing failed issue" (diff)
downloadlinux-dev-2dbc80caf7e93c3d49787cf939fc416873125c1b.tar.xz
linux-dev-2dbc80caf7e93c3d49787cf939fc416873125c1b.zip
ASoC: Intel: check and clear runtime module pointer
Add check runtime module pointers before freeing them, and clear them to NULL after freed. With this implemented, we can avoid NULL pointer dereference or double free errors. Signed-off-by: Jie Yang <yang.jie@intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/intel/haswell')
-rw-r--r--sound/soc/intel/haswell/sst-haswell-pcm.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sound/soc/intel/haswell/sst-haswell-pcm.c b/sound/soc/intel/haswell/sst-haswell-pcm.c
index 23ae0400d6db..f97fa5ab93d3 100644
--- a/sound/soc/intel/haswell/sst-haswell-pcm.c
+++ b/sound/soc/intel/haswell/sst-haswell-pcm.c
@@ -928,10 +928,15 @@ static void hsw_pcm_free_modules(struct hsw_priv_data *pdata)
for (i = 0; i < ARRAY_SIZE(mod_map); i++) {
pcm_data = &pdata->pcm[mod_map[i].dai_id][mod_map[i].stream];
- sst_hsw_runtime_module_free(pcm_data->runtime);
+ if (pcm_data->runtime){
+ sst_hsw_runtime_module_free(pcm_data->runtime);
+ pcm_data->runtime = NULL;
+ }
}
- if (sst_hsw_is_module_loaded(hsw, SST_HSW_MODULE_WAVES)) {
+ if (sst_hsw_is_module_loaded(hsw, SST_HSW_MODULE_WAVES) &&
+ pdata->runtime_waves) {
sst_hsw_runtime_module_free(pdata->runtime_waves);
+ pdata->runtime_waves = NULL;
}
}