aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2014-04-03 23:04:35 -0400
committerMark Brown <broonie@linaro.org>2014-04-04 06:11:18 -0400
commit06b4b813058f6092ded5d7e0d92d4c34d92975bd (patch)
tree0154d76655f0b9bbd555af22754eecb0449a1639 /sound/soc/codecs
parentc159a85013afbb8283f0c7272812952e04d5c3a1 (diff)
ASoC: cs42xx8: Check return value of regmap_read and report correct chipid value
Fix checking return value of regmap_read(). Also fix reporting the chip_id value. CS42XX8_CHIPID_CHIP_ID_MASK is 0xF0, so the chip_id value is (val & CS42XX8_CHIPID_CHIP_ID_MASK) >> 4). Signed-off-by: Axel Lin <axel.lin@ingics.com> Acked-by: Paul Handrigan <paul.handrigan@cirrus.com> Acked-by: Brian Austin <brian.austin@cirrus.com> Acked-by: Nicolin Chen <Guangyu.Chen@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound/soc/codecs')
-rw-r--r--sound/soc/codecs/cs42xx8.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/sound/soc/codecs/cs42xx8.c b/sound/soc/codecs/cs42xx8.c
index 082299a4e2fa..85020322eee7 100644
--- a/sound/soc/codecs/cs42xx8.c
+++ b/sound/soc/codecs/cs42xx8.c
@@ -495,17 +495,16 @@ int cs42xx8_probe(struct device *dev, struct regmap *regmap)
495 regcache_cache_bypass(cs42xx8->regmap, true); 495 regcache_cache_bypass(cs42xx8->regmap, true);
496 496
497 /* Validate the chip ID */ 497 /* Validate the chip ID */
498 regmap_read(cs42xx8->regmap, CS42XX8_CHIPID, &val); 498 ret = regmap_read(cs42xx8->regmap, CS42XX8_CHIPID, &val);
499 if (val < 0) { 499 if (ret < 0) {
500 dev_err(dev, "failed to get device ID: %x", val); 500 dev_err(dev, "failed to get device ID, ret = %d", ret);
501 ret = -EINVAL;
502 goto err_enable; 501 goto err_enable;
503 } 502 }
504 503
505 /* The top four bits of the chip ID should be 0000 */ 504 /* The top four bits of the chip ID should be 0000 */
506 if ((val & CS42XX8_CHIPID_CHIP_ID_MASK) != 0x00) { 505 if (((val & CS42XX8_CHIPID_CHIP_ID_MASK) >> 4) != 0x00) {
507 dev_err(dev, "unmatched chip ID: %d\n", 506 dev_err(dev, "unmatched chip ID: %d\n",
508 val & CS42XX8_CHIPID_CHIP_ID_MASK); 507 (val & CS42XX8_CHIPID_CHIP_ID_MASK) >> 4);
509 ret = -EINVAL; 508 ret = -EINVAL;
510 goto err_enable; 509 goto err_enable;
511 } 510 }