Skip to contentSkip to conversation

ASoC: wm_adsp: Check return value from wm_adsp_buffer_init

PATCH Superseded Charles Keepax 2 participants 3 messages Nov 22, 2016

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: wm_adsp: Check return value from wm_adsp_buffer_init

We are not checking the return value from a call to wm_adsp_buffer_init it looks like this used to be returned at the bottom of the function but probably got missed when more error paths were added. This patch adds the appropriate error check.

---
 sound/soc/codecs/wm_adsp.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
sound/soc/codecs/wm_adsp.c +4 -1
index 6ccb731..7e4f8dd 100644
@@ -2580,8 +2580,11 @@ int wm_adsp2_event(struct snd_soc_dapm_widget *w,
 
 		mutex_lock(&dsp->pwr_lock);
 
-		if (wm_adsp_fw[dsp->fw].num_caps != 0)
+		if (wm_adsp_fw[dsp->fw].num_caps != 0) {
 			ret = wm_adsp_buffer_init(dsp);
+			if (ret < 0)
+				goto err;
+		}
 
 		mutex_unlock(&dsp->pwr_lock);
 
Signature · 1 line
2.1.4
#1 lore raw

Charles,

Quoted 15 lines · Charles Keepax

We are not checking the return value from a call to wm_adsp_buffer_init it looks like this used to be returned at the bottom of the function but probably got missed when more error paths were added. This patch adds the appropriate error check.

---
 sound/soc/codecs/wm_adsp.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
sound/soc/codecs/wm_adsp.c +0 -0
index 6ccb731..7e4f8dd 100644

sound/soc/codecs/wm_adsp.c int wm_adsp2_event(struct snd_soc_dapm_widget *w, · line 2587

Quoted 9 lines
sound/soc/codecs/wm_adsp.c +4 -1
@@ -2580,8 +2580,11 @@ int wm_adsp2_event(struct snd_soc_dapm_widget *w,
 
 		mutex_lock(&dsp->pwr_lock);
 
-		if (wm_adsp_fw[dsp->fw].num_caps != 0)
+		if (wm_adsp_fw[dsp->fw].num_caps != 0) {
 			ret = wm_adsp_buffer_init(dsp);
+			if (ret < 0)
+				goto err;
+		}

Need to call mutex_unlock() before jumping to err label?

sound/soc/codecs/wm_adsp.c int wm_adsp2_event(struct snd_soc_dapm_widget *w, · line 2589

Quoted 2 lines
sound/soc/codecs/wm_adsp.c +0 -0
 		mutex_unlock(&dsp->pwr_lock);

Regards

Takashi Sakamoto

#2 lore raw
Quoted 21 lines · Takashi Sakamoto

Charles,

Quoted 18 lines · Charles Keepax

We are not checking the return value from a call to wm_adsp_buffer_init it looks like this used to be returned at the bottom of the function but probably got missed when more error paths were added. This patch adds the appropriate error check.

---
 sound/soc/codecs/wm_adsp.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
sound/soc/codecs/wm_adsp.c +0 -0
index 6ccb731..7e4f8dd 100644
@@ -2580,8 +2580,11 @@ int wm_adsp2_event(struct snd_soc_dapm_widget *w,
 
 		mutex_lock(&dsp->pwr_lock);
 
Quoted 9 lines

sound/soc/codecs/wm_adsp.c int wm_adsp2_event(struct snd_soc_dapm_widget *w, · line 2587

Quoted 6 lines
sound/soc/codecs/wm_adsp.c +4 -1
-		if (wm_adsp_fw[dsp->fw].num_caps != 0)
+		if (wm_adsp_fw[dsp->fw].num_caps != 0) {
 			ret = wm_adsp_buffer_init(dsp);
+			if (ret < 0)
+				goto err;
+		}

Need to call mutex_unlock() before jumping to err label?

Thanks, will respin.

Thanks,
Charles