diff mbox

ASoC: rt5640: add default case for unexpected ID

Message ID 1399362966-19908-1-git-send-email-bardliao@realtek.com (mailing list archive)
State Accepted
Commit 57f174f47e73b4e6f325c9374c17f5fe1602e496
Headers show

Commit Message

Bard Liao May 6, 2014, 7:56 a.m. UTC
From: Bard Liao <bardliao@realtek.com>

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>
---
 sound/soc/codecs/rt5640.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Stephen Warren May 6, 2014, 5:15 p.m. UTC | #1
On 05/06/2014 01:56 AM, bardliao@realtek.com wrote:
> From: Bard Liao <bardliao@realtek.com>
> 
> 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.

Reviewed-by: Stephen Warren <swarren@nvidia.com>
Mark Brown May 12, 2014, 9:09 p.m. UTC | #2
On Tue, May 06, 2014 at 03:56:06PM +0800, bardliao@realtek.com wrote:
> From: Bard Liao <bardliao@realtek.com>
> 
> 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.
diff mbox

Patch

diff --git a/sound/soc/codecs/rt5640.c b/sound/soc/codecs/rt5640.c
index b0967df..9e0d48f 100644
--- a/sound/soc/codecs/rt5640.c
+++ b/sound/soc/codecs/rt5640.c
@@ -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;