diff mbox

ASoC: qcom: Return an error for invalid PCM trigger command

Message ID 1428927809-4919-1-git-send-email-tiwai@suse.de (mailing list archive)
State Accepted
Commit 96f05be37f4ece1dffba92d4ae079a486a4cf6df
Headers show

Commit Message

Takashi Iwai April 13, 2015, 12:23 p.m. UTC
Fix a compile warning
  sound/soc/qcom/lpass-cpu.c: In function ‘lpass_cpu_daiops_trigger’:
  sound/soc/qcom/lpass-cpu.c:224:2: warning: ‘ret’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    return ret;
      ^
Although switch () lists the most of existing cases, it's still better
to cover the rest as an error properly.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/soc/qcom/lpass-cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Kenneth Westfield April 14, 2015, 11:31 p.m. UTC | #1
On Mon, Apr 13, 2015 at 02:23:29PM +0200, Takashi Iwai wrote:
> Fix a compile warning
>   sound/soc/qcom/lpass-cpu.c: In function ???lpass_cpu_daiops_trigger???:
>   sound/soc/qcom/lpass-cpu.c:224:2: warning: ???ret??? may be used uninitialized in this function [-Wmaybe-uninitialized]
>     return ret;
>       ^
> Although switch () lists the most of existing cases, it's still better
> to cover the rest as an error properly.
> 
> Signed-off-by: Takashi Iwai <tiwai@suse.de>
> ---
>  sound/soc/qcom/lpass-cpu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Acked-by: Kenneth Westfield <kwestfie@codeaurora.org>
Mark Brown April 15, 2015, 4:04 p.m. UTC | #2
On Mon, Apr 13, 2015 at 02:23:29PM +0200, Takashi Iwai wrote:
> Fix a compile warning
>   sound/soc/qcom/lpass-cpu.c: In function ‘lpass_cpu_daiops_trigger’:

Applied, thanks.
diff mbox

Patch

diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c
index 6698d058de29..dc790abaa331 100644
--- a/sound/soc/qcom/lpass-cpu.c
+++ b/sound/soc/qcom/lpass-cpu.c
@@ -194,7 +194,7 @@  static int lpass_cpu_daiops_trigger(struct snd_pcm_substream *substream,
 		int cmd, struct snd_soc_dai *dai)
 {
 	struct lpass_data *drvdata = snd_soc_dai_get_drvdata(dai);
-	int ret;
+	int ret = -EINVAL;
 
 	switch (cmd) {
 	case SNDRV_PCM_TRIGGER_START: