Skip to contentSkip to conversation

ASoC: Report an error for unknown adav80x formats

PATCH In review Mark Brown 2 participants 3 messages Jul 16, 2011

Subsystems (3)
lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/1 ASoC: Report an error for unknown adav80x formats

Not only fixes error handling but also some uninitialized variable warnings.

---
 sound/soc/codecs/adav80x.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
sound/soc/codecs/adav80x.c +2 -2
index e30fba6..300c04b 100644
@@ -456,7 +456,7 @@ static int adav80x_set_capture_pcm_format(struct snd_soc_codec *codec,
 		val = ADAV80X_CAPTURE_WORD_LEN24;
 		break;
 	default:
-		break;
+		return -EINVAL;
 	}
 
 	snd_soc_update_bits(codec, adav80x_port_ctrl_regs[dai->id][0],
@@ -488,7 +488,7 @@ static int adav80x_set_playback_pcm_format(struct snd_soc_codec *codec,
 		val = ADAV80X_PLAYBACK_MODE_RIGHT_J_24;
 		break;
 	default:
-		break;
+		return -EINVAL;
 	}
 
 	snd_soc_update_bits(codec, adav80x_port_ctrl_regs[dai->id][1],
Signature · 1 line
1.7.5.4
author
#2 lore raw
Quoted 5 lines · Lars-Peter Clausen
Quoted 1 line · Mark Brown

Not only fixes error handling

Doesn't the core make sure that hw_params is only called with those formats listed as supported formats?

Yes, but the compiler doesn't know that - I only noticed this due to the uninitialized variable warnings.