Commit e371eadf authored by Charles Keepax's avatar Charles Keepax Committed by Mark Brown

ASoC: cs35l41: Don't overwrite returned error code

In multiple places the driver overwrites the error code returned with
a static error code, this is not helpful for debugging. Update to pass
the error codes straight through.
Signed-off-by: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20210914141349.30218-4-ckeepax@opensource.cirrus.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent fe1024d5
...@@ -317,7 +317,6 @@ static int cs35l41_otp_unpack(void *data) ...@@ -317,7 +317,6 @@ static int cs35l41_otp_unpack(void *data)
ret = regmap_read(cs35l41->regmap, CS35L41_OTPID, &otp_id_reg); ret = regmap_read(cs35l41->regmap, CS35L41_OTPID, &otp_id_reg);
if (ret < 0) { if (ret < 0) {
dev_err(cs35l41->dev, "Read OTP ID failed\n"); dev_err(cs35l41->dev, "Read OTP ID failed\n");
ret = -EINVAL;
goto err_otp_unpack; goto err_otp_unpack;
} }
...@@ -337,7 +336,6 @@ static int cs35l41_otp_unpack(void *data) ...@@ -337,7 +336,6 @@ static int cs35l41_otp_unpack(void *data)
CS35L41_OTP_SIZE_WORDS); CS35L41_OTP_SIZE_WORDS);
if (ret < 0) { if (ret < 0) {
dev_err(cs35l41->dev, "Read OTP Mem failed\n"); dev_err(cs35l41->dev, "Read OTP Mem failed\n");
ret = -EINVAL;
goto err_otp_unpack; goto err_otp_unpack;
} }
...@@ -352,13 +350,11 @@ static int cs35l41_otp_unpack(void *data) ...@@ -352,13 +350,11 @@ static int cs35l41_otp_unpack(void *data)
ret = regmap_write(cs35l41->regmap, CS35L41_TEST_KEY_CTL, 0x00000055); ret = regmap_write(cs35l41->regmap, CS35L41_TEST_KEY_CTL, 0x00000055);
if (ret < 0) { if (ret < 0) {
dev_err(cs35l41->dev, "Write Unlock key failed 1/2\n"); dev_err(cs35l41->dev, "Write Unlock key failed 1/2\n");
ret = -EINVAL;
goto err_otp_unpack; goto err_otp_unpack;
} }
ret = regmap_write(cs35l41->regmap, CS35L41_TEST_KEY_CTL, 0x000000AA); ret = regmap_write(cs35l41->regmap, CS35L41_TEST_KEY_CTL, 0x000000AA);
if (ret < 0) { if (ret < 0) {
dev_err(cs35l41->dev, "Write Unlock key failed 2/2\n"); dev_err(cs35l41->dev, "Write Unlock key failed 2/2\n");
ret = -EINVAL;
goto err_otp_unpack; goto err_otp_unpack;
} }
...@@ -398,7 +394,6 @@ static int cs35l41_otp_unpack(void *data) ...@@ -398,7 +394,6 @@ static int cs35l41_otp_unpack(void *data)
otp_val << otp_map[i].shift); otp_val << otp_map[i].shift);
if (ret < 0) { if (ret < 0) {
dev_err(cs35l41->dev, "Write OTP val failed\n"); dev_err(cs35l41->dev, "Write OTP val failed\n");
ret = -EINVAL;
goto err_otp_unpack; goto err_otp_unpack;
} }
} }
...@@ -407,13 +402,11 @@ static int cs35l41_otp_unpack(void *data) ...@@ -407,13 +402,11 @@ static int cs35l41_otp_unpack(void *data)
ret = regmap_write(cs35l41->regmap, CS35L41_TEST_KEY_CTL, 0x000000CC); ret = regmap_write(cs35l41->regmap, CS35L41_TEST_KEY_CTL, 0x000000CC);
if (ret < 0) { if (ret < 0) {
dev_err(cs35l41->dev, "Write Lock key failed 1/2\n"); dev_err(cs35l41->dev, "Write Lock key failed 1/2\n");
ret = -EINVAL;
goto err_otp_unpack; goto err_otp_unpack;
} }
ret = regmap_write(cs35l41->regmap, CS35L41_TEST_KEY_CTL, 0x00000033); ret = regmap_write(cs35l41->regmap, CS35L41_TEST_KEY_CTL, 0x00000033);
if (ret < 0) { if (ret < 0) {
dev_err(cs35l41->dev, "Write Lock key failed 2/2\n"); dev_err(cs35l41->dev, "Write Lock key failed 2/2\n");
ret = -EINVAL;
goto err_otp_unpack; goto err_otp_unpack;
} }
ret = 0; ret = 0;
...@@ -1413,7 +1406,6 @@ int cs35l41_probe(struct cs35l41_private *cs35l41, ...@@ -1413,7 +1406,6 @@ int cs35l41_probe(struct cs35l41_private *cs35l41,
/* CS35L41 needs INT for PDN_DONE */ /* CS35L41 needs INT for PDN_DONE */
if (ret != 0) { if (ret != 0) {
dev_err(cs35l41->dev, "Failed to request IRQ: %d\n", ret); dev_err(cs35l41->dev, "Failed to request IRQ: %d\n", ret);
ret = -ENODEV;
goto err; goto err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment