Linux Sound subsystem development
 help / color / mirror / Atom feed
* [PATCH 0/4] ASoC: starfive: Simplify probe error handling
@ 2026-07-23 11:10 phucduc.bui
  2026-07-23 11:10 ` [PATCH 1/4] ASoC: starfive: jh7110-pwmdac: Remove unnecessary goto phucduc.bui
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: phucduc.bui @ 2026-07-23 11:10 UTC (permalink / raw)
  To: Hal Feng, Xingyu Wu, Mark Brown, Jaroslav Kysela, Takashi Iwai
  Cc: Walker Chen, linux-sound, linux-kernel, bui duc phuc

From: bui duc phuc <phucduc.bui@gmail.com>

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(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/4] ASoC: starfive: jh7110-pwmdac: Remove unnecessary goto
  2026-07-23 11:10 [PATCH 0/4] ASoC: starfive: Simplify probe error handling phucduc.bui
@ 2026-07-23 11:10 ` phucduc.bui
  2026-07-23 11:10 ` [PATCH 2/4] ASoC: starfive: jh7110-pwmdac: Drop redundant error messages phucduc.bui
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: phucduc.bui @ 2026-07-23 11:10 UTC (permalink / raw)
  To: Hal Feng, Xingyu Wu, Mark Brown, Jaroslav Kysela, Takashi Iwai
  Cc: Walker Chen, linux-sound, linux-kernel, bui duc phuc

From: bui duc phuc <phucduc.bui@gmail.com>

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.

Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
 sound/soc/starfive/jh7110_pwmdac.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/sound/soc/starfive/jh7110_pwmdac.c b/sound/soc/starfive/jh7110_pwmdac.c
index a603dd17931c..562936981cf0 100644
--- a/sound/soc/starfive/jh7110_pwmdac.c
+++ b/sound/soc/starfive/jh7110_pwmdac.c
@@ -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)
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/4] ASoC: starfive: jh7110-pwmdac: Drop redundant error messages
  2026-07-23 11:10 [PATCH 0/4] ASoC: starfive: Simplify probe error handling phucduc.bui
  2026-07-23 11:10 ` [PATCH 1/4] ASoC: starfive: jh7110-pwmdac: Remove unnecessary goto phucduc.bui
@ 2026-07-23 11:10 ` phucduc.bui
  2026-07-23 11:10 ` [PATCH 3/4] ASoC: starfive: jh7110_tdm: Remove unnecessary goto phucduc.bui
  2026-07-23 11:10 ` [PATCH 4/4] ASoC: starfive: jh7110_tdm: Drop redundant error messages phucduc.bui
  3 siblings, 0 replies; 5+ messages in thread
From: phucduc.bui @ 2026-07-23 11:10 UTC (permalink / raw)
  To: Hal Feng, Xingyu Wu, Mark Brown, Jaroslav Kysela, Takashi Iwai
  Cc: Walker Chen, linux-sound, linux-kernel, bui duc phuc

From: bui duc phuc <phucduc.bui@gmail.com>

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

Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
 sound/soc/starfive/jh7110_pwmdac.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/starfive/jh7110_pwmdac.c b/sound/soc/starfive/jh7110_pwmdac.c
index 562936981cf0..5953c3a4e373 100644
--- a/sound/soc/starfive/jh7110_pwmdac.c
+++ b/sound/soc/starfive/jh7110_pwmdac.c
@@ -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)) {
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/4] ASoC: starfive: jh7110_tdm: Remove unnecessary goto
  2026-07-23 11:10 [PATCH 0/4] ASoC: starfive: Simplify probe error handling phucduc.bui
  2026-07-23 11:10 ` [PATCH 1/4] ASoC: starfive: jh7110-pwmdac: Remove unnecessary goto phucduc.bui
  2026-07-23 11:10 ` [PATCH 2/4] ASoC: starfive: jh7110-pwmdac: Drop redundant error messages phucduc.bui
@ 2026-07-23 11:10 ` phucduc.bui
  2026-07-23 11:10 ` [PATCH 4/4] ASoC: starfive: jh7110_tdm: Drop redundant error messages phucduc.bui
  3 siblings, 0 replies; 5+ messages in thread
From: phucduc.bui @ 2026-07-23 11:10 UTC (permalink / raw)
  To: Hal Feng, Xingyu Wu, Mark Brown, Jaroslav Kysela, Takashi Iwai
  Cc: Walker Chen, linux-sound, linux-kernel, bui duc phuc

From: bui duc phuc <phucduc.bui@gmail.com>

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.

Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
 sound/soc/starfive/jh7110_tdm.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/sound/soc/starfive/jh7110_tdm.c b/sound/soc/starfive/jh7110_tdm.c
index afdcde7df91a..5365ebe44471 100644
--- a/sound/soc/starfive/jh7110_tdm.c
+++ b/sound/soc/starfive/jh7110_tdm.c
@@ -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)
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 4/4] ASoC: starfive: jh7110_tdm: Drop redundant error messages
  2026-07-23 11:10 [PATCH 0/4] ASoC: starfive: Simplify probe error handling phucduc.bui
                   ` (2 preceding siblings ...)
  2026-07-23 11:10 ` [PATCH 3/4] ASoC: starfive: jh7110_tdm: Remove unnecessary goto phucduc.bui
@ 2026-07-23 11:10 ` phucduc.bui
  3 siblings, 0 replies; 5+ messages in thread
From: phucduc.bui @ 2026-07-23 11:10 UTC (permalink / raw)
  To: Hal Feng, Xingyu Wu, Mark Brown, Jaroslav Kysela, Takashi Iwai
  Cc: Walker Chen, linux-sound, linux-kernel, bui duc phuc

From: bui duc phuc <phucduc.bui@gmail.com>

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

Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
 sound/soc/starfive/jh7110_tdm.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/sound/soc/starfive/jh7110_tdm.c b/sound/soc/starfive/jh7110_tdm.c
index 5365ebe44471..f7522bfbe8e6 100644
--- a/sound/soc/starfive/jh7110_tdm.c
+++ b/sound/soc/starfive/jh7110_tdm.c
@@ -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)) {
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-07-23 11:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-23 11:10 [PATCH 0/4] ASoC: starfive: Simplify probe error handling phucduc.bui
2026-07-23 11:10 ` [PATCH 1/4] ASoC: starfive: jh7110-pwmdac: Remove unnecessary goto phucduc.bui
2026-07-23 11:10 ` [PATCH 2/4] ASoC: starfive: jh7110-pwmdac: Drop redundant error messages phucduc.bui
2026-07-23 11:10 ` [PATCH 3/4] ASoC: starfive: jh7110_tdm: Remove unnecessary goto phucduc.bui
2026-07-23 11:10 ` [PATCH 4/4] ASoC: starfive: jh7110_tdm: Drop redundant error messages phucduc.bui

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox