Skip to contentSkip to conversation

ASoC: starfive: Simplify probe error handling

PATCH In review [email protected] 2 participants 6 messages Jul 23 – Jul 30

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

cover ASoC: starfive: Simplify probe error handling

From: bui duc phuc <[email protected]>

Hi all,

This series cleans up the probe error paths in the StarFive ASoC drivers by removing unnecessary goto statements and redundant error messages.

Compile-tested only.

Best regards,
Phuc

bui duc phuc (4):
ASoC: starfive: jh7110-pwmdac: Remove unnecessary goto
ASoC: starfive: jh7110-pwmdac: Drop redundant error messages
ASoC: starfive: jh7110_tdm: Remove unnecessary goto
ASoC: starfive: jh7110_tdm: Drop redundant error messages

 sound/soc/starfive/jh7110_pwmdac.c | 15 ++++++---------
 sound/soc/starfive/jh7110_tdm.c    | 27 ++++++++-------------------
 2 files changed, 14 insertions(+), 28 deletions(-)
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/4 ASoC: starfive: jh7110-pwmdac: Remove unnecessary goto

From: bui duc phuc <[email protected]>

The error path after jh7110_pwmdac_runtime_resume() failure only performs a single cleanup operation before returning. Remove the unnecessary goto and return directly after calling pm_runtime_disable(), simplifying the control flow without changing the behavior.

---
 sound/soc/starfive/jh7110_pwmdac.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
sound/soc/starfive/jh7110_pwmdac.c +4 -7
index a603dd17931c..562936981cf0 100644
@@ -486,16 +486,13 @@ static int jh7110_pwmdac_probe(struct platform_device *pdev)
 	pm_runtime_enable(dev->dev);
 	if (!pm_runtime_enabled(&pdev->dev)) {
 		ret = jh7110_pwmdac_runtime_resume(&pdev->dev);
-		if (ret)
-			goto err_pm_disable;
+		if (ret) {
+			pm_runtime_disable(&pdev->dev);
+			return ret;
+		}
 	}
 
 	return 0;
-
-err_pm_disable:
-	pm_runtime_disable(&pdev->dev);
-
-	return ret;
 }
 
 static void jh7110_pwmdac_remove(struct platform_device *pdev)
Signature · 1 line
2.43.0
#2 lore raw

PATCH 2/4 ASoC: starfive: jh7110-pwmdac: Drop redundant error messages

In reply to [email protected]

From: bui duc phuc <[email protected]>

The called functions already log failures where appropriate. Return the original error directly and avoid duplicate error messages.

---
 sound/soc/starfive/jh7110_pwmdac.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/starfive/jh7110_pwmdac.c +2 -2
index 562936981cf0..5953c3a4e373 100644
@@ -477,11 +477,11 @@ static int jh7110_pwmdac_probe(struct platform_device *pdev)
 					      &jh7110_pwmdac_component,
 					      &jh7110_pwmdac_dai, 1);
 	if (ret)
-		return dev_err_probe(&pdev->dev, ret, "failed to register dai\n");
+		return ret;
 
 	ret = devm_snd_dmaengine_pcm_register(&pdev->dev, NULL, 0);
 	if (ret)
-		return dev_err_probe(&pdev->dev, ret, "failed to register pcm\n");
+		return ret;
 
 	pm_runtime_enable(dev->dev);
 	if (!pm_runtime_enabled(&pdev->dev)) {
Signature · 1 line
2.43.0
#3 lore raw

PATCH 3/4 ASoC: starfive: jh7110_tdm: Remove unnecessary goto

In reply to [email protected]

From: bui duc phuc <[email protected]>

The error path after jh7110_tdm_runtime_resume() failure only performs a single cleanup operation before returning. Remove the unnecessary goto and return directly after calling pm_runtime_disable(), simplifying the control flow without changing the behavior.

---
 sound/soc/starfive/jh7110_tdm.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
sound/soc/starfive/jh7110_tdm.c +4 -7
index afdcde7df91a..5365ebe44471 100644
@@ -615,16 +615,13 @@ static int jh7110_tdm_probe(struct platform_device *pdev)
 	pm_runtime_enable(&pdev->dev);
 	if (!pm_runtime_enabled(&pdev->dev)) {
 		ret = jh7110_tdm_runtime_resume(&pdev->dev);
-		if (ret)
-			goto err_pm_disable;
+		if (ret) {
+			pm_runtime_disable(&pdev->dev);
+			return ret;
+		}
 	}
 
 	return 0;
-
-err_pm_disable:
-	pm_runtime_disable(&pdev->dev);
-
-	return ret;
 }
 
 static void jh7110_tdm_dev_remove(struct platform_device *pdev)
Signature · 1 line
2.43.0
#4 lore raw

PATCH 4/4 ASoC: starfive: jh7110_tdm: Drop redundant error messages

In reply to [email protected]

From: bui duc phuc <[email protected]>

The called functions already log failures where appropriate. Return the original error directly and avoid duplicate error messages.

---
 sound/soc/starfive/jh7110_tdm.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)
sound/soc/starfive/jh7110_tdm.c +4 -12
index 5365ebe44471..f7522bfbe8e6 100644
@@ -559,10 +559,8 @@ static int jh7110_tdm_clk_reset_get(struct platform_device *pdev,
 	tdm->clks[5].id = "tdm";
 
 	ret = devm_clk_bulk_get(&pdev->dev, ARRAY_SIZE(tdm->clks), tdm->clks);
-	if (ret) {
-		dev_err(&pdev->dev, "Failed to get tdm clocks\n");
+	if (ret)
 		return ret;
-	}
 
 	tdm->resets = devm_reset_control_array_get_exclusive(&pdev->dev);
 	if (IS_ERR(tdm->resets)) {
@@ -589,28 +587,22 @@ static int jh7110_tdm_probe(struct platform_device *pdev)
 	tdm->dev = &pdev->dev;
 
 	ret = jh7110_tdm_clk_reset_get(pdev, tdm);
-	if (ret) {
-		dev_err(&pdev->dev, "Failed to enable audio-tdm clock\n");
+	if (ret)
 		return ret;
-	}
 
 	jh7110_tdm_init_params(tdm);
 
 	dev_set_drvdata(&pdev->dev, tdm);
 	ret = devm_snd_soc_register_component(&pdev->dev, &jh7110_tdm_component,
 					      &jh7110_tdm_dai, 1);
-	if (ret) {
-		dev_err(&pdev->dev, "Failed to register dai\n");
+	if (ret)
 		return ret;
-	}
 
 	ret = devm_snd_dmaengine_pcm_register(&pdev->dev,
 					      &jh7110_dmaengine_pcm_config,
 					      SND_DMAENGINE_PCM_FLAG_COMPAT);
-	if (ret) {
-		dev_err(&pdev->dev, "Could not register pcm: %d\n", ret);
+	if (ret)
 		return ret;
-	}
 
 	pm_runtime_enable(&pdev->dev);
 	if (!pm_runtime_enabled(&pdev->dev)) {
Signature · 1 line
2.43.0
maintainer
#5 lore raw
In reply to [email protected]
Quoted 11 lines · On Thu, 23 Jul 2026 18:10:10 +0700, [email protected] wrote:

ASoC: starfive: Simplify probe error handling

From: bui duc phuc <[email protected]>

Hi all,

This series cleans up the probe error paths in the StarFive ASoC drivers by removing unnecessary goto statements and redundant error messages.

[...]

Applied to

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

Thanks!

[1/4] ASoC: starfive: jh7110-pwmdac: Remove unnecessary goto

      https://git.kernel.org/broonie/sound/c/65ebc8347a9c
[2/4] ASoC: starfive: jh7110-pwmdac: Drop redundant error messages
      https://git.kernel.org/broonie/sound/c/db233669245d
[3/4] ASoC: starfive: jh7110_tdm: Remove unnecessary goto
      https://git.kernel.org/broonie/sound/c/de621dacea09
[4/4] ASoC: starfive: jh7110_tdm: Drop redundant error messages
      https://git.kernel.org/broonie/sound/c/523c01b12ec1

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