diff options
author | Charles Keepax <ckeepax@opensource.cirrus.com> | 2021-05-11 11:10:50 +0100 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2021-05-11 15:42:43 +0100 |
commit | fd4e6baa6256b9c5cb6d8d6a020093ee9aee0372 (patch) | |
tree | 220adff2c62a786b1b5d07d1bc9b8c68fb813f13 /sound/soc/codecs/cs4265.c | |
parent | ASoC: cs35l36: Remove unneeded variable initialisation (diff) | |
download | linux-dev-fd4e6baa6256b9c5cb6d8d6a020093ee9aee0372.tar.xz linux-dev-fd4e6baa6256b9c5cb6d8d6a020093ee9aee0372.zip |
ASoC: cs4265: Minor tidy up of error paths
Fixup a needlessly initialised variable and an unchecked return value.
Reported-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20210511101051.17726-2-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/codecs/cs4265.c')
-rw-r--r-- | sound/soc/codecs/cs4265.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/sound/soc/codecs/cs4265.c b/sound/soc/codecs/cs4265.c index d76be44f46b4..cffd6111afac 100644 --- a/sound/soc/codecs/cs4265.c +++ b/sound/soc/codecs/cs4265.c @@ -573,7 +573,7 @@ static int cs4265_i2c_probe(struct i2c_client *i2c_client, const struct i2c_device_id *id) { struct cs4265_private *cs4265; - int ret = 0; + int ret; unsigned int devid = 0; unsigned int reg; @@ -602,6 +602,11 @@ static int cs4265_i2c_probe(struct i2c_client *i2c_client, i2c_set_clientdata(i2c_client, cs4265); ret = regmap_read(cs4265->regmap, CS4265_CHIP_ID, ®); + if (ret) { + dev_err(&i2c_client->dev, "Failed to read chip ID: %d\n", ret); + return ret; + } + devid = reg & CS4265_CHIP_ID_MASK; if (devid != CS4265_CHIP_ID_VAL) { ret = -ENODEV; @@ -616,10 +621,9 @@ static int cs4265_i2c_probe(struct i2c_client *i2c_client, regmap_write(cs4265->regmap, CS4265_PWRCTL, 0x0F); - ret = devm_snd_soc_register_component(&i2c_client->dev, + return devm_snd_soc_register_component(&i2c_client->dev, &soc_component_cs4265, cs4265_dai, ARRAY_SIZE(cs4265_dai)); - return ret; } static const struct of_device_id cs4265_of_match[] = { |