Commit bf62eec5 authored by Shuming Fan's avatar Shuming Fan Committed by Mark Brown

ASoC: rt5645: check return value after reading device id

If the I2C controller encounters some problems like timed-out, the codec
driver will report the error code for the first read.
Signed-off-by: default avatarShuming Fan <shumingf@realtek.com>
Link: https://lore.kernel.org/r/20230705042915.24932-1-shumingf@realtek.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent d9ba2975
......@@ -3950,7 +3950,11 @@ static int rt5645_i2c_probe(struct i2c_client *i2c)
* read and power On.
*/
msleep(TIME_TO_POWER_MS);
regmap_read(regmap, RT5645_VENDOR_ID2, &val);
ret = regmap_read(regmap, RT5645_VENDOR_ID2, &val);
if (ret < 0) {
dev_err(&i2c->dev, "Failed to read: 0x%02X\n, ret = %d", RT5645_VENDOR_ID2, ret);
goto err_enable;
}
switch (val) {
case RT5645_DEVICE_ID:
......
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