diff options
author | Shuming Fan <shumingf@realtek.com> | 2023-07-05 12:29:14 +0800 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2023-07-05 13:00:54 +0100 |
commit | bf62eec5cdecbe7eeab02407da98f36cd7b1dea7 (patch) | |
tree | 39ea8fb406eb68f6b7619907bfcf7c26b6fbf214 | |
parent | d9ba2975e98a4bec0a9f8d4be4c1de8883fccb71 (diff) | |
download | lwn-bf62eec5cdecbe7eeab02407da98f36cd7b1dea7.tar.gz lwn-bf62eec5cdecbe7eeab02407da98f36cd7b1dea7.zip |
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>
-rw-r--r-- | sound/soc/codecs/rt5645.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index acc7fb1581b2..a506d940a2ea 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c @@ -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: |