Skip to contentSkip to conversation

ASoC: samsung: Improve probe error handling

PATCH In review [email protected] 3 participants 9 messages Aug 12 – Sep 1

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

v2 cover ASoC: samsung: Improve probe error handling

From: bui duc phuc <[email protected]>

Hi all,

This series improves probe error handling in several Samsung ASoC drivers.

Preserve the original error code from gpiod_to_irq() and use dev_err_probe() where appropriate. Also remove redundant probe error messages where the called functions already report the error.

Compile-tested only.

Changes in v2:
- Add Cezary Rojewski's Reviewed-by tag.
- Update the commit message.

Best regards,
Phuc

bui duc phuc (6):
ASoC: samsung: aries_wm8994: Preserve gpiod_to_irq() error codes
ASoC: samsung: aries_wm8994: Drop redundant probe error messages
ASoC: samsung: pcm: Use dev_err_probe() for error handling
ASoC: samsung: pcm: Drop redundant probe error messages
ASoC: samsung: spdif: Drop redundant probe error messages
ASoC: samsung: tm2_wm5110: Drop redundant probe error messages

 sound/soc/samsung/aries_wm8994.c | 14 ++++----------
 sound/soc/samsung/pcm.c          | 19 +++++++------------
 sound/soc/samsung/spdif.c        |  8 ++------
 sound/soc/samsung/tm2_wm5110.c   | 12 +++---------
 4 files changed, 16 insertions(+), 37 deletions(-)
Signature · 1 line
2.43.0
#1 lore raw

PATCH v2 1/6 ASoC: samsung: aries_wm8994: Preserve gpiod_to_irq() error codes

From: bui duc phuc <[email protected]>

gpiod_to_irq() can currently return several error codes, including -ENXIO, -ENODEV, -EPROBE_DEFER, and -EINVAL.

Return the original error code instead of overwriting it with -EINVAL, so that the actual failure reason is preserved.

---

Changes in v2:
- Add Cezary Rojewski's Reviewed-by tag.

 sound/soc/samsung/aries_wm8994.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/samsung/aries_wm8994.c +1 -1
index 6db91b73f25c..58e3e08225de 100644
@@ -374,7 +374,7 @@ static int aries_late_probe(struct snd_soc_card *card)
 	irq = gpiod_to_irq(priv->gpio_headset_detect);
 	if (irq < 0) {
 		dev_err(card->dev, "Failed to map headset detect gpio to irq");
-		return -EINVAL;
+		return irq;
 	}
 
 	ret = devm_request_threaded_irq(card->dev, irq, NULL,
Signature · 1 line
2.43.0
#2 lore raw

PATCH v2 2/6 ASoC: samsung: aries_wm8994: Drop redundant probe error messages

In reply to [email protected]

From: bui duc phuc <[email protected]>

The functions called here don't log the error themselves, but the error is already reported deeper in the call chain, so the dev_err() calls are redundant and can be removed.

---

Changes in v2:
- Update the commit message.

 sound/soc/samsung/aries_wm8994.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
sound/soc/samsung/aries_wm8994.c +3 -9
index 58e3e08225de..d189db96cf17 100644
@@ -381,10 +381,8 @@ static int aries_late_probe(struct snd_soc_card *card)
 			headset_det_irq_thread,
 			IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING |
 			IRQF_ONESHOT, "headset_detect", priv);
-	if (ret) {
-		dev_err(card->dev, "Failed to request headset detect irq");
+	if (ret)
 		return ret;
-	}
 
 	headset_button_gpio[0].data = priv;
 	headset_button_gpio[0].desc = priv->gpio_headset_key;
@@ -623,10 +621,8 @@ static int aries_audio_probe(struct platform_device *pdev)
 	if (ret < 0) {
 		/* Backwards compatible way */
 		ret = snd_soc_of_parse_audio_routing(card, "samsung,audio-routing");
-		if (ret < 0) {
-			dev_err(dev, "Audio routing invalid/unspecified\n");
+		if (ret < 0)
 			return ret;
-		}
 	}
 
 	aries_dai[1].dai_fmt = priv->variant->modem_dai_fmt;
@@ -671,10 +667,8 @@ static int aries_audio_probe(struct platform_device *pdev)
 
 	ret = devm_snd_soc_register_component(dev, &aries_component,
 				aries_ext_dai, ARRAY_SIZE(aries_ext_dai));
-	if (ret < 0) {
-		dev_err(dev, "Failed to register component: %d\n", ret);
+	if (ret < 0)
 		goto out;
-	}
 
 	ret = devm_snd_soc_register_card(dev, card);
 	if (ret)
Signature · 1 line
2.43.0
#3 lore raw

PATCH v2 3/6 ASoC: samsung: pcm: Use dev_err_probe() for error handling

In reply to [email protected]

From: bui duc phuc <[email protected]>

Replace dev_err() with dev_err_probe() to prevent log spam when probe returns -EPROBE_DEFER.

---

Changes in v2:
- Add Cezary Rojewski's Reviewed-by tag.

 sound/soc/samsung/pcm.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
sound/soc/samsung/pcm.c +5 -6
index 309f024bf2a4..7e7284125c3e 100644
@@ -499,10 +499,9 @@ static int s3c_pcm_dev_probe(struct platform_device *pdev)
 		return PTR_ERR(pcm->regs);
 
 	pcm->cclk = devm_clk_get(&pdev->dev, "audio-bus");
-	if (IS_ERR(pcm->cclk)) {
-		dev_err(&pdev->dev, "failed to get audio-bus clock\n");
-		return PTR_ERR(pcm->cclk);
-	}
+	if (IS_ERR(pcm->cclk))
+		return dev_err_probe(&pdev->dev, PTR_ERR(pcm->cclk),
+				     "failed to get audio-bus clock\n");
 	ret = clk_prepare_enable(pcm->cclk);
 	if (ret)
 		return ret;
@@ -512,8 +511,8 @@ static int s3c_pcm_dev_probe(struct platform_device *pdev)
 
 	pcm->pclk = devm_clk_get(&pdev->dev, "pcm");
 	if (IS_ERR(pcm->pclk)) {
-		dev_err(&pdev->dev, "failed to get pcm clock\n");
-		ret = PTR_ERR(pcm->pclk);
+		ret = dev_err_probe(&pdev->dev, PTR_ERR(pcm->pclk),
+				    "failed to get pcm clock\n");
 		goto err_dis_cclk;
 	}
 	ret = clk_prepare_enable(pcm->pclk);
Signature · 1 line
2.43.0
#4 lore raw

PATCH v2 4/6 ASoC: samsung: pcm: Drop redundant probe error messages

In reply to [email protected]

From: bui duc phuc <[email protected]>

The functions called here don't log the error themselves, but the error is already reported deeper in the call chain, so the dev_err() calls are redundant and can be removed.

---

Changes in v2:
- Update the commit message.

 sound/soc/samsung/pcm.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
sound/soc/samsung/pcm.c +2 -6
index 7e7284125c3e..8430686760d7 100644
@@ -534,19 +534,15 @@ static int s3c_pcm_dev_probe(struct platform_device *pdev)
 
 	ret = samsung_asoc_dma_platform_register(&pdev->dev, filter,
 						 NULL, NULL, NULL);
-	if (ret) {
-		dev_err(&pdev->dev, "failed to get register DMA: %d\n", ret);
+	if (ret)
 		goto err_dis_pclk;
-	}
 
 	pm_runtime_enable(&pdev->dev);
 
 	ret = devm_snd_soc_register_component(&pdev->dev, &s3c_pcm_component,
 					 &s3c_pcm_dai[pdev->id], 1);
-	if (ret != 0) {
-		dev_err(&pdev->dev, "failed to get register DAI: %d\n", ret);
+	if (ret != 0)
 		goto err_dis_pm;
-	}
 
 	return 0;
 
Signature · 1 line
2.43.0
#5 lore raw

PATCH v2 5/6 ASoC: samsung: spdif: Drop redundant probe error messages

In reply to [email protected]

From: bui duc phuc <[email protected]>

The functions called here don't log the error themselves, but the error is already reported deeper in the call chain, so the dev_err() calls are redundant and can be removed.

---

Changes in v2:
- Update the commit message.

 sound/soc/samsung/spdif.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
sound/soc/samsung/spdif.c +2 -6
index 53eaabaf8956..719083e8e89d 100644
@@ -415,19 +415,15 @@ static int spdif_probe(struct platform_device *pdev)
 
 	ret = samsung_asoc_dma_platform_register(&pdev->dev, filter,
 						 NULL, NULL, NULL);
-	if (ret) {
-		dev_err(&pdev->dev, "failed to register DMA: %d\n", ret);
+	if (ret)
 		goto err2;
-	}
 
 	dev_set_drvdata(&pdev->dev, spdif);
 
 	ret = devm_snd_soc_register_component(&pdev->dev,
 			&samsung_spdif_component, &samsung_spdif_dai, 1);
-	if (ret != 0) {
-		dev_err(&pdev->dev, "fail to register dai\n");
+	if (ret != 0)
 		goto err2;
-	}
 
 	return 0;
 err2:
Signature · 1 line
2.43.0
#6 lore raw

PATCH v2 6/6 ASoC: samsung: tm2_wm5110: Drop redundant probe error messages

In reply to [email protected]

From: bui duc phuc <[email protected]>

The errors handled here are already reported by the called functions, either directly or deeper in the call chain. Therefore, the additional dev_err() calls are redundant and can be removed.

---

Changes in v2:
- Update the commit message.

 sound/soc/samsung/tm2_wm5110.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
sound/soc/samsung/tm2_wm5110.c +3 -9
index f1f59e059f5d..f4912826dfd4 100644
@@ -518,19 +518,15 @@ static int tm2_probe(struct platform_device *pdev)
 	}
 
 	ret = snd_soc_of_parse_card_name(card, "model");
-	if (ret < 0) {
-		dev_err(dev, "Card name is not specified\n");
+	if (ret < 0)
 		return ret;
-	}
 
 	ret = snd_soc_of_parse_audio_routing(card, "audio-routing");
 	if (ret < 0) {
 		/* Backwards compatible way */
 		ret = snd_soc_of_parse_audio_routing(card, "samsung,audio-routing");
-		if (ret < 0) {
-			dev_err(dev, "Audio routing is not specified or invalid\n");
+		if (ret < 0)
 			return ret;
-		}
 	}
 
 	card->aux_dev[0].dlc.of_node = of_parse_phandle(dev->of_node,
@@ -609,10 +605,8 @@ static int tm2_probe(struct platform_device *pdev)
 
 	ret = devm_snd_soc_register_component(dev, &tm2_component,
 				tm2_ext_dai, ARRAY_SIZE(tm2_ext_dai));
-	if (ret < 0) {
-		dev_err(dev, "Failed to register component: %d\n", ret);
+	if (ret < 0)
 		goto dai_node_put;
-	}
 
 	ret = devm_snd_soc_register_card(dev, card);
 	if (ret < 0) {
Signature · 1 line
2.43.0
Reviewed-by on the v2 series
#7 lore raw
In reply to [email protected]
Quoted 11 lines · On 8/12/2026 10:51 AM, [email protected] wrote:

From: bui duc phuc <[email protected]>

Hi all,

This series improves probe error handling in several Samsung ASoC drivers.

Preserve the original error code from gpiod_to_irq() and use dev_err_probe() where appropriate. Also remove redundant probe error messages where the called functions already report the error.

Quoted 5 lines

Compile-tested only.

Changes in v2:
- Add Cezary Rojewski's Reviewed-by tag.
- Update the commit message.

Thank you for the update, LGTM:

maintainer
#8 lore raw
In reply to [email protected]
Quoted 10 lines · On Wed, 12 Aug 2026 15:51:27 +0700, [email protected] wrote:

ASoC: samsung: Improve probe error handling

From: bui duc phuc <[email protected]>

Hi all,

This series improves probe error handling in several Samsung ASoC drivers.

[...]

Applied to

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

Thanks!

[1/6] ASoC: samsung: aries_wm8994: Preserve gpiod_to_irq() error codes
https://git.kernel.org/broonie/sound/c/bfaefd8aef4a
[2/6] ASoC: samsung: aries_wm8994: Drop redundant probe error messages

      https://git.kernel.org/broonie/sound/c/445c3c59affe
[3/6] ASoC: samsung: pcm: Use dev_err_probe() for error handling
      https://git.kernel.org/broonie/sound/c/87874c260c1a
[4/6] ASoC: samsung: pcm: Drop redundant probe error messages
      https://git.kernel.org/broonie/sound/c/961501768994
[5/6] ASoC: samsung: spdif: Drop redundant probe error messages
      https://git.kernel.org/broonie/sound/c/84234ee45fe2
[6/6] ASoC: samsung: tm2_wm5110: Drop redundant probe error messages
      https://git.kernel.org/broonie/sound/c/29b8bc168a25

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