ASoC: Return early with -EINVAL if invalid dai format is detected
Subsystems (3)
PATCH v2 1/1 ASoC: Return early with -EINVAL if invalid dai format is detected
Signed-off-by Axel Lin <[email protected]>
Cc Timur Tabi <[email protected]>
Cc Arnaud Patard <[email protected]>
--- sound/soc/codecs/cs4270.c | 8 ++++---- sound/soc/codecs/cs42l51.c | 9 ++++----- 2 files changed, 8 insertions(+), 9 deletions(-)
sound/soc/codecs/cs4270.c +4 -4
@@ -261,7 +261,6 @@ static int cs4270_set_dai_fmt(struct snd_soc_dai *codec_dai, {struct snd_soc_codec *codec = codec_dai->codec;struct cs4270_private *cs4270 =snd_soc_codec_get_drvdata (codec); -int ret =0 ;/* set DAI format */ switch (format &SND_SOC_DAIFMT_FORMAT_MASK ) {
@@ -271,7 +270,7 @@ static int cs4270_set_dai_fmt(struct snd_soc_dai *codec_dai,break ;default :dev_err (codec->dev,"invalid dai format\n" ); - ret = -EINVAL ; +return -EINVAL ; }/* set master/slave audio interface */
@@ -284,10 +283,11 @@ static int cs4270_set_dai_fmt(struct snd_soc_dai *codec_dai,break ;default :/* all other modes are unsupported by the hardware */ - ret = -EINVAL ; +dev_err (codec->dev,"Unknown master/slave configuration\n" ); +return -EINVAL ; } -return ret; +return 0 ; }/**
sound/soc/codecs/cs42l51.c +4 -5
@@ -288,7 +288,6 @@ static int cs42l51_set_dai_fmt(struct snd_soc_dai *codec_dai, {struct snd_soc_codec *codec = codec_dai->codec;struct cs42l51_private *cs42l51 =snd_soc_codec_get_drvdata (codec); -int ret =0 ;switch (format &SND_SOC_DAIFMT_FORMAT_MASK ) {case SND_SOC_DAIFMT_I2S :
@@ -298,7 +297,7 @@ static int cs42l51_set_dai_fmt(struct snd_soc_dai *codec_dai,break ;default :dev_err (codec->dev,"invalid DAI format\n" ); - ret = -EINVAL ; +return -EINVAL ; }switch (format &SND_SOC_DAIFMT_MASTER_MASK ) {
@@ -309,11 +308,11 @@ static int cs42l51_set_dai_fmt(struct snd_soc_dai *codec_dai, cs42l51->func =MODE_SLAVE_AUTO ;break ;default : - ret = -EINVAL ; -break ; +dev_err (codec->dev,"Unknown master/slave configuration\n" ); +return -EINVAL ; } -return ret; +return 0 ; }struct cs42l51_ratios {
Signature · 1 line
1.7.4.1
Quoted 4 lines · Axel Lin
Signed-off-by Axel Lin<[email protected]>Cc Timur Tabi<[email protected]>Cc Arnaud Patard<[email protected]>---
Acked-by Timur Tabi <[email protected]>
Signature · 2 lines
Timur Tabi Linux kernel developer at Freescale
Mark Brown
AppliedQuoted 1 line · Axel Lin
Signed-off-by Axel Lin <[email protected]>
Applied, thanks.