Skip to contentSkip to conversation

ASoC: cs35l36: Remove unneeded variable initialisation

PATCH In review Charles Keepax 3 participants 5 messages May 11, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 ASoC: cs35l36: Remove unneeded variable initialisation

---
 sound/soc/codecs/cs35l36.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/cs35l36.c +1 -1
index a038bcec2d17c..db5472b10465b 100644
@@ -1156,7 +1156,7 @@ static int cs35l36_component_probe(struct snd_soc_component *component)
 {
 	struct cs35l36_private *cs35l36 =
 			snd_soc_component_get_drvdata(component);
-	int ret = 0;
+	int ret;
 
 	if ((cs35l36->rev_id == CS35L36_REV_A0) && cs35l36->pdata.dcm_mode) {
 		regmap_update_bits(cs35l36->regmap, CS35L36_BSTCVRT_DCM_CTRL,
Signature · 1 line
2.11.0
#1 lore raw

PATCH 2/3 ASoC: cs4265: Minor tidy up of error paths

Fixup a needlessly initialised variable and an unchecked return value.

---
 sound/soc/codecs/cs4265.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
sound/soc/codecs/cs4265.c +7 -3
index d76be44f46b40..cffd6111afaca 100644
@@ -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, &reg);
+	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[] = {
Signature · 1 line
2.11.0
#2 lore raw

PATCH 3/3 ASoC: cs42l52: Minor tidy up of error paths

In reply to Charles Keepax

Fixup a needlessly initialised variable and an unchecked return value.

---
 sound/soc/codecs/cs42l52.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
sound/soc/codecs/cs42l52.c +7 -5
index 796b894c390fe..88547e2cd53dc 100644
@@ -1093,7 +1093,7 @@ static int cs42l52_i2c_probe(struct i2c_client *i2c_client,
 	struct cs42l52_private *cs42l52;
 	struct cs42l52_platform_data *pdata = dev_get_platdata(&i2c_client->dev);
 	int ret;
-	unsigned int devid = 0;
+	unsigned int devid;
 	unsigned int reg;
 	u32 val32;
 
@@ -1163,6 +1163,11 @@ static int cs42l52_i2c_probe(struct i2c_client *i2c_client,
 			 ret);
 
 	ret = regmap_read(cs42l52->regmap, CS42L52_CHIP, &reg);
+	if (ret) {
+		dev_err(&i2c_client->dev, "Failed to read chip ID: %d\n", ret);
+		return ret;
+	}
+
 	devid = reg & CS42L52_CHIP_ID_MASK;
 	if (devid != CS42L52_CHIP_ID) {
 		ret = -ENODEV;
@@ -1199,11 +1204,8 @@ static int cs42l52_i2c_probe(struct i2c_client *i2c_client,
 				   CS42L52_IFACE_CTL2_BIAS_LVL,
 				cs42l52->pdata.micbias_lvl);
 
-	ret =  devm_snd_soc_register_component(&i2c_client->dev,
+	return devm_snd_soc_register_component(&i2c_client->dev,
 			&soc_component_dev_cs42l52, &cs42l52_dai, 1);
-	if (ret < 0)
-		return ret;
-	return 0;
 }
 
 static const struct of_device_id cs42l52_of_match[] = {
Signature · 1 line
2.11.0
#3 lore raw
In reply to Charles Keepax
Quoted 2 lines · Charles Keepax

Thanks, I rechecked with this patchset applied on top of the previous one, there's only one warning left:

sound/soc/codecs/cs42l56.c:1308:6: style: Variable 'ret' is reassigned a value before the old one has been used. [redundantAssignment]
ret = devm_snd_soc_register_component(&i2c_client->dev,

     ^
sound/soc/codecs/cs42l56.c:1247:6: note: ret is assigned
 ret = regmap_read(cs42l56->regmap, CS42L56_CHIP_ID_1, &reg);
     ^
sound/soc/codecs/cs42l56.c:1308:6: note: ret is overwritten
 ret =  devm_snd_soc_register_component(&i2c_client->dev,
     ^
Quoted 18 lines
---
  sound/soc/codecs/cs35l36.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/cs35l36.c +1 -1
index a038bcec2d17c..db5472b10465b 100644
@@ -1156,7 +1156,7 @@ static int cs35l36_component_probe(struct snd_soc_component *component)
  {
  	struct cs35l36_private *cs35l36 =
  			snd_soc_component_get_drvdata(component);
-	int ret = 0;
+	int ret;
 
  	if ((cs35l36->rev_id == CS35L36_REV_A0) && cs35l36->pdata.dcm_mode) {
  		regmap_update_bits(cs35l36->regmap, CS35L36_BSTCVRT_DCM_CTRL,
maintainer
#4 lore raw
In reply to Charles Keepax
Quoted 1 line · Charles Keepax

Applied to

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

Thanks!

[1/3] ASoC: cs35l36: Remove unneeded variable initialisation

      commit: 634a4be0f9d16428779d60bb40fd852f888f0a34
[2/3] ASoC: cs4265: Minor tidy up of error paths
      commit: fd4e6baa6256b9c5cb6d8d6a020093ee9aee0372
[3/3] ASoC: cs42l52: Minor tidy up of error paths
      commit: 4ac9b48adf4d561d0e33419d548278f205dd70b5

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