Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: <bardliao@realtek.com>
To: broonie@kernel.org, lgirdwood@gmail.com
Cc: oder_chiou@realtek.com, alsa-devel@alsa-project.org,
	lars@metafoo.de, swarren@wwwdotorg.org, bardliao@realtek.com,
	flove@realtek.com
Subject: [PATCH] ASoC: rt5640: add default case for unexpected ID
Date: Tue, 6 May 2014 15:56:06 +0800	[thread overview]
Message-ID: <1399362966-19908-1-git-send-email-bardliao@realtek.com> (raw)

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(+)

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;
-- 
1.8.1.1.439.g50a6b54

             reply	other threads:[~2014-05-06  7:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-06  7:56 bardliao [this message]
2014-05-06 17:15 ` [PATCH] ASoC: rt5640: add default case for unexpected ID Stephen Warren
2014-05-12 21:09 ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1399362966-19908-1-git-send-email-bardliao@realtek.com \
    --to=bardliao@realtek.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=flove@realtek.com \
    --cc=lars@metafoo.de \
    --cc=lgirdwood@gmail.com \
    --cc=oder_chiou@realtek.com \
    --cc=swarren@wwwdotorg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox