diff mbox series

ASoC: soc-pcm: add the judgment of unsupported commands for the function soc_pcm_trigger

Message ID tencent_002E3C6C67928986481018466EEDF8D05706@qq.com (mailing list archive)
State New, archived
Headers show
Series ASoC: soc-pcm: add the judgment of unsupported commands for the function soc_pcm_trigger | expand

Commit Message

xuhanwu March 8, 2024, 10:07 a.m. UTC
From: xuhanwu <xu.hanwu@zxelec.com>

Function soc_pcm_trigger, if the parameter cmd does not support the need to return an error (-EINVAL).

Signed-off-by: xuhanwu <xu.hanwu@zxelec.com>
---
 sound/soc/soc-pcm.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Mark Brown March 8, 2024, 2:21 p.m. UTC | #1
On Fri, Mar 08, 2024 at 06:07:06PM +0800, xuhanwu wrote:

> Function soc_pcm_trigger, if the parameter cmd does not support the need to return an error (-EINVAL).

Please fix your mail client to word wrap within paragraphs at something
substantially less than 80 columns.  Doing this makes your messages much
easier to read and reply to.

> @@ -1173,6 +1173,9 @@ static int soc_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
>  			if (r < 0)
>  				break;
>  		}
> +		break;
> +	default:
> +		return -EINVAL;
>  	}

As can be seen from inspection of the immediately preceeding handling
of start, we're deliberately ignoring half the values in each switch.
diff mbox series

Patch

diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 77ee103b7..eba737729 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -1173,6 +1173,9 @@  static int soc_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
 			if (r < 0)
 				break;
 		}
+		break;
+	default:
+		return -EINVAL;
 	}
 
 	/*