diff options
author | Axel Lin <axel.lin@gmail.com> | 2011-10-05 19:29:56 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-10-06 15:02:56 -0400 |
commit | ac60155f7afa3fd819befa35c2740a7a0d2f1a39 (patch) | |
tree | 2e3c5e858b608fd6c0a7583f580b76d6242c57b1 /sound/soc/codecs | |
parent | 3c08600144f2a15fb3fba31b54cd6600371db6ef (diff) |
ASoC: Return early with -EINVAL if invalid dai format is detected
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Timur Tabi <timur@freescale.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/codecs')
-rw-r--r-- | sound/soc/codecs/cs4270.c | 8 | ||||
-rw-r--r-- | sound/soc/codecs/cs42l51.c | 9 |
2 files changed, 8 insertions, 9 deletions
diff --git a/sound/soc/codecs/cs4270.c b/sound/soc/codecs/cs4270.c index 5830c934a1d1..f1f237ecec2a 100644 --- a/sound/soc/codecs/cs4270.c +++ b/sound/soc/codecs/cs4270.c | |||
@@ -261,7 +261,6 @@ static int cs4270_set_dai_fmt(struct snd_soc_dai *codec_dai, | |||
261 | { | 261 | { |
262 | struct snd_soc_codec *codec = codec_dai->codec; | 262 | struct snd_soc_codec *codec = codec_dai->codec; |
263 | struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec); | 263 | struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec); |
264 | int ret = 0; | ||
265 | 264 | ||
266 | /* set DAI format */ | 265 | /* set DAI format */ |
267 | switch (format & SND_SOC_DAIFMT_FORMAT_MASK) { | 266 | switch (format & SND_SOC_DAIFMT_FORMAT_MASK) { |
@@ -271,7 +270,7 @@ static int cs4270_set_dai_fmt(struct snd_soc_dai *codec_dai, | |||
271 | break; | 270 | break; |
272 | default: | 271 | default: |
273 | dev_err(codec->dev, "invalid dai format\n"); | 272 | dev_err(codec->dev, "invalid dai format\n"); |
274 | ret = -EINVAL; | 273 | return -EINVAL; |
275 | } | 274 | } |
276 | 275 | ||
277 | /* set master/slave audio interface */ | 276 | /* set master/slave audio interface */ |
@@ -284,10 +283,11 @@ static int cs4270_set_dai_fmt(struct snd_soc_dai *codec_dai, | |||
284 | break; | 283 | break; |
285 | default: | 284 | default: |
286 | /* all other modes are unsupported by the hardware */ | 285 | /* all other modes are unsupported by the hardware */ |
287 | ret = -EINVAL; | 286 | dev_err(codec->dev, "Unknown master/slave configuration\n"); |
287 | return -EINVAL; | ||
288 | } | 288 | } |
289 | 289 | ||
290 | return ret; | 290 | return 0; |
291 | } | 291 | } |
292 | 292 | ||
293 | /** | 293 | /** |
diff --git a/sound/soc/codecs/cs42l51.c b/sound/soc/codecs/cs42l51.c index 286878d22b6a..8c3c8205d19e 100644 --- a/sound/soc/codecs/cs42l51.c +++ b/sound/soc/codecs/cs42l51.c | |||
@@ -288,7 +288,6 @@ static int cs42l51_set_dai_fmt(struct snd_soc_dai *codec_dai, | |||
288 | { | 288 | { |
289 | struct snd_soc_codec *codec = codec_dai->codec; | 289 | struct snd_soc_codec *codec = codec_dai->codec; |
290 | struct cs42l51_private *cs42l51 = snd_soc_codec_get_drvdata(codec); | 290 | struct cs42l51_private *cs42l51 = snd_soc_codec_get_drvdata(codec); |
291 | int ret = 0; | ||
292 | 291 | ||
293 | switch (format & SND_SOC_DAIFMT_FORMAT_MASK) { | 292 | switch (format & SND_SOC_DAIFMT_FORMAT_MASK) { |
294 | case SND_SOC_DAIFMT_I2S: | 293 | case SND_SOC_DAIFMT_I2S: |
@@ -298,7 +297,7 @@ static int cs42l51_set_dai_fmt(struct snd_soc_dai *codec_dai, | |||
298 | break; | 297 | break; |
299 | default: | 298 | default: |
300 | dev_err(codec->dev, "invalid DAI format\n"); | 299 | dev_err(codec->dev, "invalid DAI format\n"); |
301 | ret = -EINVAL; | 300 | return -EINVAL; |
302 | } | 301 | } |
303 | 302 | ||
304 | switch (format & SND_SOC_DAIFMT_MASTER_MASK) { | 303 | switch (format & SND_SOC_DAIFMT_MASTER_MASK) { |
@@ -309,11 +308,11 @@ static int cs42l51_set_dai_fmt(struct snd_soc_dai *codec_dai, | |||
309 | cs42l51->func = MODE_SLAVE_AUTO; | 308 | cs42l51->func = MODE_SLAVE_AUTO; |
310 | break; | 309 | break; |
311 | default: | 310 | default: |
312 | ret = -EINVAL; | 311 | dev_err(codec->dev, "Unknown master/slave configuration\n"); |
313 | break; | 312 | return -EINVAL; |
314 | } | 313 | } |
315 | 314 | ||
316 | return ret; | 315 | return 0; |
317 | } | 316 | } |
318 | 317 | ||
319 | struct cs42l51_ratios { | 318 | struct cs42l51_ratios { |