Skip to content

Commit bf62eec

Browse files
shumingfanbroonie
authored andcommitted
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: Shuming Fan <shumingf@realtek.com> Link: https://lore.kernel.org/r/20230705042915.24932-1-shumingf@realtek.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent d9ba297 commit bf62eec

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

sound/soc/codecs/rt5645.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3950,7 +3950,11 @@ static int rt5645_i2c_probe(struct i2c_client *i2c)
39503950
* read and power On.
39513951
*/
39523952
msleep(TIME_TO_POWER_MS);
3953-
regmap_read(regmap, RT5645_VENDOR_ID2, &val);
3953+
ret = regmap_read(regmap, RT5645_VENDOR_ID2, &val);
3954+
if (ret < 0) {
3955+
dev_err(&i2c->dev, "Failed to read: 0x%02X\n, ret = %d", RT5645_VENDOR_ID2, ret);
3956+
goto err_enable;
3957+
}
39543958

39553959
switch (val) {
39563960
case RT5645_DEVICE_ID:

0 commit comments

Comments
 (0)