ASoC: rt5640: add default case for unexpected ID
authorBard Liao <bardliao@realtek.com>
Tue, 6 May 2014 07:56:06 +0000 (15:56 +0800)
committerMark Brown <broonie@linaro.org>
Mon, 12 May 2014 21:09:30 +0000 (22:09 +0100)
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 <bardliao@realtek.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
sound/soc/codecs/rt5640.c

index 2133fa0..ddefd5a 100644 (file)
@@ -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;