Skip to contentSkip to conversation

ASoC: rt5640: add default case for unexpected ID

PATCH Applied [email protected] 3 participants 3 messages May 6, 2014 – May 12, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: rt5640: add default case for unexpected ID

From: Bard Liao <[email protected]>

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.

---
 sound/soc/codecs/rt5640.c | 4 ++++
 1 file changed, 4 insertions(+)
sound/soc/codecs/rt5640.c +4 -0
index b0967df..9e0d48f 100644
@@ -2019,6 +2019,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;
Signature · 1 line
1.8.1.1.439.g50a6b54
maintainer Applied
#2 lore raw
In reply to [email protected]
Quoted 6 lines · On Tue, May 06, 2014 at 03:56:06PM +0800, [email protected] wrote:

From: Bard Liao <[email protected]>

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.

Applied, thanks.