Commit 397e089b authored by Derek Fang's avatar Derek Fang Committed by Mark Brown

ASoC: rt1015: check the return value of regmap_read during i2c probe

In some projects, the device ID register is not read correctly.
This patch helps to verify the issue is caused from i2c host or client.
Signed-off-by: default avatarDerek Fang <derek.fang@realtek.com>
Link: https://lore.kernel.org/r/20201209091308.2823-1-derek.fang@realtek.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent e648e3f1
......@@ -1207,8 +1207,13 @@ static int rt1015_i2c_probe(struct i2c_client *i2c,
rt1015->hw_config = (i2c->addr == 0x29) ? RT1015_HW_29 : RT1015_HW_28;
regmap_read(rt1015->regmap, RT1015_DEVICE_ID, &val);
if ((val != RT1015_DEVICE_ID_VAL) && (val != RT1015_DEVICE_ID_VAL2)) {
ret = regmap_read(rt1015->regmap, RT1015_DEVICE_ID, &val);
if (ret) {
dev_err(&i2c->dev,
"Failed to read device register: %d\n", ret);
return ret;
} else if ((val != RT1015_DEVICE_ID_VAL) &&
(val != RT1015_DEVICE_ID_VAL2)) {
dev_err(&i2c->dev,
"Device with ID register %x is not rt1015\n", val);
return -ENODEV;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment