diff options
author | Bard Liao <bardliao@realtek.com> | 2015-03-24 09:51:12 +0800 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-03-24 08:56:13 -0700 |
commit | 143526ee94a295ed33b9cc19e9532ab6d14a1cc0 (patch) | |
tree | 09c471bea9d2cf97c7575a9bc81f883b9b30b06e /sound/soc/codecs/rt286.c | |
parent | 0dd96b3e39df83265ef3f79170a623cebee50380 (diff) | |
download | linux-143526ee94a295ed33b9cc19e9532ab6d14a1cc0.tar.bz2 |
ASoC: rt286: check regmap_read result for ID check
It is worth to check the regmap_read result for ID check since it
is the first regmap_read. And we can check if there is any i2c
issue.
Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/codecs/rt286.c')
-rw-r--r-- | sound/soc/codecs/rt286.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/sound/soc/codecs/rt286.c b/sound/soc/codecs/rt286.c index ea967978ec6b..842cfb9fa191 100644 --- a/sound/soc/codecs/rt286.c +++ b/sound/soc/codecs/rt286.c @@ -1219,7 +1219,7 @@ static int rt286_i2c_probe(struct i2c_client *i2c, { struct rt286_platform_data *pdata = dev_get_platdata(&i2c->dev); struct rt286_priv *rt286; - int i, ret; + int i, ret, val; rt286 = devm_kzalloc(&i2c->dev, sizeof(*rt286), GFP_KERNEL); @@ -1234,11 +1234,15 @@ static int rt286_i2c_probe(struct i2c_client *i2c, return ret; } - regmap_read(rt286->regmap, - RT286_GET_PARAM(AC_NODE_ROOT, AC_PAR_VENDOR_ID), &ret); - if (ret != RT286_VENDOR_ID && ret != RT288_VENDOR_ID) { + ret = regmap_read(rt286->regmap, + RT286_GET_PARAM(AC_NODE_ROOT, AC_PAR_VENDOR_ID), &val); + if (ret != 0) { + dev_err(&i2c->dev, "I2C error %d\n", ret); + return ret; + } + if (val != RT286_VENDOR_ID && val != RT288_VENDOR_ID) { dev_err(&i2c->dev, - "Device with ID register %x is not rt286\n", ret); + "Device with ID register %x is not rt286\n", val); return -ENODEV; } |