From: Bard Liao Date: Tue, 6 May 2014 07:56:06 +0000 (+0800) Subject: ASoC: rt5640: add default case for unexpected ID X-Git-Tag: firefly_0821_release~176^2~3750^2~24^2~4^3~2 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=57f174f47e73b4e6f325c9374c17f5fe1602e496;p=firefly-linux-kernel-4.4.55.git ASoC: rt5640: add default case for unexpected ID We may read an unexpected value when detemining which codec is attached. In that case, either a unsupported codec is attached or something wrong with I2C. The driver will not work properly on both cases. So we return an error for that. Signed-off-by: Bard Liao Reviewed-by: Stephen Warren Signed-off-by: Mark Brown --- diff --git a/sound/soc/codecs/rt5640.c b/sound/soc/codecs/rt5640.c index 2133fa0c5114..ddefd5a476d0 100644 --- a/sound/soc/codecs/rt5640.c +++ b/sound/soc/codecs/rt5640.c @@ -2018,6 +2018,10 @@ static int rt5640_probe(struct snd_soc_codec *codec) rt5639_specific_dapm_routes, ARRAY_SIZE(rt5639_specific_dapm_routes)); break; + default: + dev_err(codec->dev, + "The driver is for RT5639 RT5640 or RT5642 only\n"); + return -ENODEV; } return 0;