diff mbox series

[2/3] ASoC: rt5645: check return value after reading device id

Message ID 20230705042915.24932-1-shumingf@realtek.com (mailing list archive)
State Accepted
Commit bf62eec5cdecbe7eeab02407da98f36cd7b1dea7
Headers show
Series [1/3] ASoC: rt5645: implement set_jack callback | expand

Commit Message

Shuming [θŒƒζ›ΈιŠ˜] July 5, 2023, 4:29 a.m. UTC
From: Shuming Fan <shumingf@realtek.com>

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>
---
 sound/soc/codecs/rt5645.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Mark Brown July 5, 2023, 4:05 p.m. UTC | #1
On Wed, 05 Jul 2023 12:29:14 +0800, shumingf@realtek.com wrote:
> If the I2C controller encounters some problems like timed-out, the codec
> driver will report the error code for the first read.
> 
> 

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[2/3] ASoC: rt5645: check return value after reading device id
      commit: bf62eec5cdecbe7eeab02407da98f36cd7b1dea7

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
diff mbox series

Patch

diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c
index c0d56a8f7f47..b0953e9bcaf9 100644
--- a/sound/soc/codecs/rt5645.c
+++ b/sound/soc/codecs/rt5645.c
@@ -3967,7 +3967,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: