Skip to contentSkip to conversation

ASoC: ti: Improve probe error handling

PATCH Superseded [email protected] 2 participants 17 messages Jul 16

Subsystems (4)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover ASoC: ti: Improve probe error handling

From: bui duc phuc <[email protected]>

Hi all,

This series cleans up probe error handling across several TI ASoC drivers.

The changes fall into two categories:
1.Replace dev_err() with dev_err_probe() when reporting probe
failures. This preserves the original error code while suppressing unnecessary log messages for deferred probe errors.
2.Preserve the original error codes returned by helper functions
instead of converting them to -ENODEV, and remove redundant error messages where the helper already reports the failure.

Build-tested only.

Changes in v2:
- Add missing parentheses to snd_soc_register_card() (Christophe).
- Remove an extra blank line (Christophe).

Best regards,
Phuc

bui duc phuc (10):
ASoC: ti: ams-delta: Use dev_err_probe() for error handling
ASoC: ti: davinci-evm: Use dev_err_probe() for error handling
ASoC: ti: j721e-evm: Return the original error from card name parsing
ASoC: ti: omap-abe-twl6040: Preserve error code and drop redundant log
ASoC: ti: omap-abe-twl6040: Use dev_err_probe() for error handling
ASoC: ti: omap-dmic: Use dev_err_probe() for error handling
ASoC: ti: omap-hdmi: Use dev_err_probe() for error handling
ASoC: ti: omap-twl4030: Return the original error code
ASoC: ti: omap-twl4030: Use dev_err_probe() for error handling
ASoC: ti: rx51: Use dev_err_probe() for error handling

 sound/soc/ti/ams-delta.c        |  4 ++--
 sound/soc/ti/davinci-evm.c      |  3 +--
 sound/soc/ti/j721e-evm.c        |  7 +++----
 sound/soc/ti/omap-abe-twl6040.c | 15 ++++++---------
 sound/soc/ti/omap-dmic.c        |  7 +++----
 sound/soc/ti/omap-hdmi.c        |  6 ++----
 sound/soc/ti/omap-twl4030.c     | 15 ++++++---------
 sound/soc/ti/rx51.c             | 28 ++++++++++++----------------
 8 files changed, 35 insertions(+), 50 deletions(-)
Signature · 1 line
2.43.0
#1 lore raw

PATCH v2 1/10 ASoC: ti: ams-delta: Use dev_err_probe() for error handling

From: bui duc phuc <[email protected]>

Use dev_err_probe() to replace dev_err() followed by returning the error code. This keeps the error handling concise and suppresses log messages for deferred probe errors.

---

Changes in v2:
- Add missing parentheses to snd_soc_register_card() (Christophe).

 sound/soc/ti/ams-delta.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/ti/ams-delta.c +2 -2
index 61252359d5cb..2759b39c4ebe 100644
@@ -574,9 +574,9 @@ static int ams_delta_probe(struct platform_device *pdev)
 
 	ret = snd_soc_register_card(card);
 	if (ret) {
-		dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret);
 		card->dev = NULL;
-		return ret;
+		return dev_err_probe(&pdev->dev, ret,
+				     "snd_soc_register_card() failed\n");
 	}
 	return 0;
 }
Signature · 1 line
2.43.0
#2 lore raw

PATCH v2 2/10 ASoC: ti: davinci-evm: 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() when reporting devm_snd_soc_register_card() failures. This suppresses unnecessary log messages for deferred probe errors.

---

Changes in v2:
- Add missing parentheses to snd_soc_register_card() (Christophe).
- Remove an extra blank line (Christophe).

 sound/soc/ti/davinci-evm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
sound/soc/ti/davinci-evm.c +1 -2
index ad514c2e5a25..3156d87a3a12 100644
@@ -245,9 +245,8 @@ static int davinci_evm_probe(struct platform_device *pdev)
 
 	snd_soc_card_set_drvdata(&evm_soc_card, drvdata);
 	ret = devm_snd_soc_register_card(&pdev->dev, &evm_soc_card);
-
 	if (ret) {
-		dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret);
+		dev_err_probe(&pdev->dev, ret, "snd_soc_register_card() failed\n");
 		goto err_put;
 	}
 
Signature · 1 line
2.43.0
#3 lore raw

PATCH v2 3/10 ASoC: ti: j721e-evm: Return the original error from card name parsing

In reply to [email protected]

From: bui duc phuc <[email protected]>

Return the error from snd_soc_of_parse_card_name() directly instead of converting it to -ENODEV. The helper already logs the error, so drop the redundant dev_err().

---
 sound/soc/ti/j721e-evm.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
sound/soc/ti/j721e-evm.c +3 -4
index 312298e0b004..600897a3e1c5 100644
@@ -870,10 +870,9 @@ static int j721e_soc_probe(struct platform_device *pdev)
 	card->num_dapm_routes = ARRAY_SIZE(j721e_cpb_dapm_routes);
 	card->fully_routed = 1;
 
-	if (snd_soc_of_parse_card_name(card, "model")) {
-		dev_err(&pdev->dev, "Card name is not provided\n");
-		return -ENODEV;
-	}
+	ret = snd_soc_of_parse_card_name(card, "model");
+	if (ret)
+		return ret;
 
 	link_cnt = 0;
 	conf_cnt = 0;
Signature · 1 line
2.43.0
#4 lore raw

PATCH v2 4/10 ASoC: ti: omap-abe-twl6040: Preserve error code and drop redundant log

In reply to [email protected]

From: bui duc phuc <[email protected]>

Return the original errors from the OF parsing helpers and remove the redundant error messages, as the helpers already report failures.

---
 sound/soc/ti/omap-abe-twl6040.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
sound/soc/ti/omap-abe-twl6040.c +4 -7
index 56aa4b22083b..dfa931071d81 100644
@@ -234,16 +234,13 @@ static int omap_abe_probe(struct platform_device *pdev)
 	card->dapm_routes = audio_map;
 	card->num_dapm_routes = ARRAY_SIZE(audio_map);
 
-	if (snd_soc_of_parse_card_name(card, "ti,model")) {
-		dev_err(&pdev->dev, "Card name is not provided\n");
-		return -ENODEV;
-	}
+	ret = snd_soc_of_parse_card_name(card, "ti,model");
+	if (ret)
+		return ret;
 
 	ret = snd_soc_of_parse_audio_routing(card, "ti,audio-routing");
-	if (ret) {
-		dev_err(&pdev->dev, "Error while parsing DAPM routing\n");
+	if (ret)
 		return ret;
-	}
 
 	dai_node = of_parse_phandle(node, "ti,mcpdm", 0);
 	if (!dai_node) {
Signature · 1 line
2.43.0
#5 lore raw

PATCH v2 5/10 ASoC: ti: omap-abe-twl6040: 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() when reporting devm_snd_soc_register_card() failures. This suppresses unnecessary log messages for deferred probe errors.

---
 sound/soc/ti/omap-abe-twl6040.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/ti/omap-abe-twl6040.c +2 -2
index dfa931071d81..05239ccc1f41 100644
@@ -296,8 +296,8 @@ static int omap_abe_probe(struct platform_device *pdev)
 
 	ret = devm_snd_soc_register_card(&pdev->dev, card);
 	if (ret)
-		dev_err(&pdev->dev, "devm_snd_soc_register_card() failed: %d\n",
-			ret);
+		dev_err_probe(&pdev->dev, ret,
+			      "devm_snd_soc_register_card() failed\n");
 
 	return ret;
 }
Signature · 1 line
2.43.0
#6 lore raw

PATCH v2 6/10 ASoC: ti: omap-dmic: 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() when handling clock lookup failures. This preserves the original error code and suppresses unnecessary deferred probe error messages.

---
 sound/soc/ti/omap-dmic.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
sound/soc/ti/omap-dmic.c +3 -4
index b795b9f66b0e..c8d791f05ae4 100644
@@ -465,10 +465,9 @@ static int asoc_dmic_probe(struct platform_device *pdev)
 	mutex_init(&dmic->mutex);
 
 	dmic->fclk = devm_clk_get(dmic->dev, "fck");
-	if (IS_ERR(dmic->fclk)) {
-		dev_err(dmic->dev, "can't get fck\n");
-		return -ENODEV;
-	}
+	if (IS_ERR(dmic->fclk))
+		return dev_err_probe(dmic->dev, PTR_ERR(dmic->fclk),
+				     "can't get fck\n");
 
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dma");
 	if (!res) {
Signature · 1 line
2.43.0
#7 lore raw

PATCH v2 7/10 ASoC: ti: omap-hdmi: 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() when reporting devm_snd_soc_register_card() failures. This suppresses unnecessary log messages for deferred probe errors.

---
 sound/soc/ti/omap-hdmi.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
sound/soc/ti/omap-hdmi.c +2 -4
index e60f5b483fc5..72114965c37d 100644
@@ -375,10 +375,8 @@ static int omap_hdmi_audio_probe(struct platform_device *pdev)
 	card->dev = dev;
 
 	ret = devm_snd_soc_register_card(dev, card);
-	if (ret) {
-		dev_err(dev, "snd_soc_register_card failed (%d)\n", ret);
-		return ret;
-	}
+	if (ret)
+		return dev_err_probe(dev, ret, "snd_soc_register_card failed\n");
 
 	ad->card = card;
 	snd_soc_card_set_drvdata(card, ad);
Signature · 1 line
2.43.0
#8 lore raw

Re: [PATCH v2 07/10] ASoC: ti: omap-hdmi: Use dev_err_probe() for error handling

Quoted 16 lines · On 7/16/2026 11:08 AM, [email protected] wrote:

From: bui duc phuc <[email protected]>

Replace dev_err() with dev_err_probe() when reporting devm_snd_soc_register_card() failures. This suppresses unnecessary log messages for deferred probe errors.

---
  sound/soc/ti/omap-hdmi.c | 6 ++----
  1 file changed, 2 insertions(+), 4 deletions(-)
sound/soc/ti/omap-hdmi.c +0 -0
index e60f5b483fc5..72114965c37d 100644

sound/soc/ti/omap-hdmi.c static int omap_hdmi_audio_probe(struct platform_device *pdev) · line 379

Quoted 9 lines
sound/soc/ti/omap-hdmi.c +2 -4
@@ -375,10 +375,8 @@ static int omap_hdmi_audio_probe(struct platform_device *pdev)
  	card->dev = dev;
 
  	ret = devm_snd_soc_register_card(dev, card);
-	if (ret) {
-		dev_err(dev, "snd_soc_register_card failed (%d)\n", ret);
-		return ret;
-	}
+	if (ret)
+		return dev_err_probe(dev, ret, "snd_soc_register_card failed\n");

Some patches have '()' some do not. I'd expect all the patches updated as per Christophe's review.

Quoted 3 lines
sound/soc/ti/omap-hdmi.c +0 -0
  	ad->card = card;
  	snd_soc_card_set_drvdata(card, ad);
#9 lore raw

Re: [PATCH v2 07/10] ASoC: ti: omap-hdmi: Use dev_err_probe() for error handling

Hi Cezary,

Thank you for your review.

Quoted 6 lines

sound/soc/ti/omap-hdmi.c static int omap_hdmi_audio_probe(struct platform_device *pdev) · line 379

Quoted 2 lines
sound/soc/ti/omap-hdmi.c +2 -0
+     if (ret)
+             return dev_err_probe(dev, ret, "snd_soc_register_card failed\n");

Some patches have '()' some do not. I'd expect all the patches updated as per Christophe's review.

Good catch. That one slipped through while I was preparing v2. I'll make it consistent across all affected patches in v3.

Best regards,
Phuc

#10 lore raw

PATCH v2 8/10 ASoC: ti: omap-twl4030: Return the original error code

In reply to [email protected]

From: bui duc phuc <[email protected]>

Return the error from snd_soc_of_parse_card_name() directly and drop the redundant error message since the helper already logs the failure.

---
 sound/soc/ti/omap-twl4030.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
sound/soc/ti/omap-twl4030.c +3 -4
index 4d80f8a7a947..2a80e44035d7 100644
@@ -253,10 +253,9 @@ static int omap_twl4030_probe(struct platform_device *pdev)
 		struct device_node *dai_node;
 		struct property *prop;
 
-		if (snd_soc_of_parse_card_name(card, "ti,model")) {
-			dev_err(&pdev->dev, "Card name is not provided\n");
-			return -ENODEV;
-		}
+		ret = snd_soc_of_parse_card_name(card, "ti,model");
+		if (ret)
+			return ret;
 
 		dai_node = of_parse_phandle(node, "ti,mcbsp", 0);
 		if (!dai_node) {
Signature · 1 line
2.43.0
#11 lore raw

PATCH v2 9/10 ASoC: ti: omap-twl4030: 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() when reporting devm_snd_soc_register_card() failures. This suppresses unnecessary log messages for deferred probe errors.

---
 sound/soc/ti/omap-twl4030.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
sound/soc/ti/omap-twl4030.c +3 -5
index 2a80e44035d7..576f4d3615e8 100644
@@ -306,11 +306,9 @@ static int omap_twl4030_probe(struct platform_device *pdev)
 
 	snd_soc_card_set_drvdata(card, priv);
 	ret = devm_snd_soc_register_card(&pdev->dev, card);
-	if (ret) {
-		dev_err(&pdev->dev, "devm_snd_soc_register_card() failed: %d\n",
-			ret);
-		return ret;
-	}
+	if (ret)
+		return dev_err_probe(&pdev->dev, ret,
+				     "devm_snd_soc_register_card() failed\n");
 
 	return 0;
 }
Signature · 1 line
2.43.0
#12 lore raw

PATCH v2 10/10 ASoC: ti: rx51: 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() when reporting probe failures. This preserves the original error code and suppresses unnecessary log messages for deferred probe errors.

---
 sound/soc/ti/rx51.c | 28 ++++++++++++----------------
 1 file changed, 12 insertions(+), 16 deletions(-)
sound/soc/ti/rx51.c +12 -16
index cfc23e0838c2..46053b8f3202 100644
@@ -418,31 +418,27 @@ static int rx51_soc_probe(struct platform_device *pdev)
 	pdata->tvout_selection_gpio = devm_gpiod_get(card->dev,
 						     "tvout-selection",
 						     GPIOD_OUT_LOW);
-	if (IS_ERR(pdata->tvout_selection_gpio)) {
-		dev_err(card->dev, "could not get tvout selection gpio\n");
-		return PTR_ERR(pdata->tvout_selection_gpio);
-	}
+	if (IS_ERR(pdata->tvout_selection_gpio))
+		return dev_err_probe(card->dev, PTR_ERR(pdata->tvout_selection_gpio),
+				     "could not get tvout selection gpio\n");
 
 	pdata->eci_sw_gpio = devm_gpiod_get(card->dev, "eci-switch",
 					    GPIOD_OUT_HIGH);
-	if (IS_ERR(pdata->eci_sw_gpio)) {
-		dev_err(card->dev, "could not get eci switch gpio\n");
-		return PTR_ERR(pdata->eci_sw_gpio);
-	}
+	if (IS_ERR(pdata->eci_sw_gpio))
+		return dev_err_probe(card->dev, PTR_ERR(pdata->eci_sw_gpio),
+				     "could not get eci switch gpio\n");
 
 	pdata->speaker_amp_gpio = devm_gpiod_get(card->dev,
 						 "speaker-amplifier",
 						 GPIOD_OUT_LOW);
-	if (IS_ERR(pdata->speaker_amp_gpio)) {
-		dev_err(card->dev, "could not get speaker enable gpio\n");
-		return PTR_ERR(pdata->speaker_amp_gpio);
-	}
+	if (IS_ERR(pdata->speaker_amp_gpio))
+		return dev_err_probe(card->dev, PTR_ERR(pdata->speaker_amp_gpio),
+				     "could not get speaker enable gpio\n");
 
 	err = devm_snd_soc_register_card(card->dev, card);
-	if (err) {
-		dev_err(card->dev, "snd_soc_register_card failed (%d)\n", err);
-		return err;
-	}
+	if (err)
+		return dev_err_probe(card->dev, err,
+				     "snd_soc_register_card failed\n");
 
 	return 0;
 }
Signature · 1 line
2.43.0
#13 lore raw

Re: [PATCH v2 10/10] ASoC: ti: rx51: Use dev_err_probe() for error handling

sound/soc/ti/rx51.c static int rx51_soc_probe(struct platform_device *pdev) · line 441

Quoted 8 lines · On 7/16/2026 11:08 AM, [email protected] wrote:
  	err = devm_snd_soc_register_card(card->dev, card);
sound/soc/ti/rx51.c +3 -4
-	if (err) {
-		dev_err(card->dev, "snd_soc_register_card failed (%d)\n", err);
-		return err;
-	}
+	if (err)
+		return dev_err_probe(card->dev, err,
+				     "snd_soc_register_card failed\n");

Pinging this patch too to make it easier, Phuc. Certainly 7/10 isn't the only one.

Quoted 3 lines
  
  	return 0;
  }
#14 lore raw

Re: [PATCH v2 10/10] ASoC: ti: rx51: Use dev_err_probe() for error handling

Hi Cezary,

Thanks for the reminder, Cezary.

Quoted 4 lines

Pinging this patch too to make it easier, Phuc. Certainly 7/10 isn't the only one.

I've fixed the remaining instances and sent the v3 series.

Best regards,
Phuc

#15 lore raw

Re: [PATCH v2 10/10] ASoC: ti: rx51: Use dev_err_probe() for error handling

Quoted 10 lines · Bui Duc Phuc

Hi Cezary,

Thanks for the reminder, Cezary.

Quoted 4 lines

Pinging this patch too to make it easier, Phuc. Certainly 7/10 isn't the only one.

I've fixed the remaining instances and sent the v3 series.

Another round of helpful tips: wait a bit before sending another revision. What if someone finds another "small" thing? It is rare to have a good reason for generating high traffic on the list. A day or two of break is OK for simple sets, week or two for features and such.

Also, please do include reviewers when sending updates - you've sent v3 without including them (e.g.: me).

Kind regards,
Czarek

#16 lore raw

Re: [PATCH v2 10/10] ASoC: ti: rx51: Use dev_err_probe() for error handling

Hi Cezary,

Thanks for the advice.

Quoted 6 lines
Quoted 2 lines

I've fixed the remaining instances and sent the v3 series.

Another round of helpful tips: wait a bit before sending another revision. What if someone finds another "small" thing? It is rare to have a good reason for generating high traffic on the list. A day or two of break is OK for simple sets, week or two for features and such.

That makes sense. I'll wait a few days before sending the next revision to give people time for any additional comments.

Quoted 4 lines

Also, please do include reviewers when sending updates - you've sent v3 without including them (e.g.: me).

Sorry about that! I put your name in the v3 changelog but accidentally reused my old ⁠git send-email⁠ command without updating the CC list. Thanks for the reminder, I'll make sure to double-check the CCs for future revisions

Best regards,
Phuc