ASoC: ti: Improve probe error handling
Subsystems (4)
cover ASoC: ti: Improve probe error handling
From: bui duc phuc <[email protected]>
Hi,
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.
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 | 3 +-- sound/soc/ti/davinci-evm.c | 2 +- sound/soc/ti/j721e-evm.c | 7 +++---- sound/soc/ti/omap-abe-twl6040.c | 14 +++++--------- 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, 33 insertions(+), 49 deletions(-)
Signature · 1 line
2.43.0
PATCH 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.
--- sound/soc/ti/ams-delta.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
sound/soc/ti/ams-delta.c +1 -2
@@ -574,9 +574,8 @@ 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
PATCH 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.
--- sound/soc/ti/davinci-evm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/ti/davinci-evm.c +1 -1
@@ -247,7 +247,7 @@ static int davinci_evm_probe(struct platform_device *pdev) 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
PATCH 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
@@ -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
PATCH 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
@@ -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
PATCH 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 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
sound/soc/ti/omap-abe-twl6040.c +1 -2
@@ -296,8 +296,7 @@ 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
PATCH 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
@@ -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
PATCH 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
@@ -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
PATCH 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
@@ -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
PATCH 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
@@ -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
PATCH 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
@@ -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
Re: [PATCH 02/10] ASoC: ti: davinci-evm: Use dev_err_probe() for error handling
In reply to [email protected]Le 14/07/2026 à 14:00, [email protected] a écrit :
Quoted 16 lines
From: bui duc phuc <[email protected]>
Replace
dev_err()withdev_err_probe()when reportingdevm_snd_soc_register_card()failures. This suppresses unnecessary log messages for deferred probe errors.Signed-off-by bui duc phuc <[email protected]>--- sound/soc/ti/davinci-evm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)sound/soc/ti/davinci-evm.c +0
-0
sound/soc/ti/davinci-evm.c static int davinci_evm_probe(struct platform_device *pdev) · line 248
Quoted 2 lines
sound/soc/ti/davinci-evm.c +0
-0@@ -247,7 +247,7 @@ static int davinci_evm_probe(struct platform_device *pdev) ret =devm_snd_soc_register_card (&pdev->dev, &evm_soc_card);
Nitpick: this blank new line could be removed.
CJ
Quoted 6 lines
sound/soc/ti/davinci-evm.c +1
-1if (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; }
Re: [PATCH 01/10] ASoC: ti: ams-delta: Use dev_err_probe() for error handling
In reply to [email protected]Le 14/07/2026 à 14:00, [email protected] a écrit :
Quoted 16 lines
From: bui duc phuc <[email protected]>
Use
dev_err_probe()to replacedev_err()followed by returning the error code. This keeps the error handling concise and suppresses log messages for deferred probe errors.Signed-off-by bui duc phuc <[email protected]>--- sound/soc/ti/ams-delta.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)sound/soc/ti/ams-delta.c +0
-0
sound/soc/ti/ams-delta.c static int ams_delta_probe(struct platform_device *pdev) · line 578
Quoted 7 lines
sound/soc/ti/ams-delta.c +1
-2@@ -574,9 +574,8 @@ 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" );
Nitpick: could add some () (i.e. snd_soc_register_card()) to match patch 9/10.
CJ
Quoted 3 lines
sound/soc/ti/ams-delta.c +0
-0}return 0 ; }
Re: [PATCH 02/10] ASoC: ti: davinci-evm: Use dev_err_probe() for error handling
In reply to [email protected]Le 14/07/2026 à 14:00, [email protected] a écrit :
Quoted 16 lines
From: bui duc phuc <[email protected]>
Replace
dev_err()withdev_err_probe()when reportingdevm_snd_soc_register_card()failures. This suppresses unnecessary log messages for deferred probe errors.Signed-off-by bui duc phuc <[email protected]>--- sound/soc/ti/davinci-evm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)sound/soc/ti/davinci-evm.c +0
-0
sound/soc/ti/davinci-evm.c static int davinci_evm_probe(struct platform_device *pdev) · line 248
Quoted 2 lines
sound/soc/ti/davinci-evm.c +0
-0@@ -247,7 +247,7 @@ static int davinci_evm_probe(struct platform_device *pdev) ret =devm_snd_soc_register_card (&pdev->dev, &evm_soc_card);
Nitpick: this blank new line could be removed.
sound/soc/ti/davinci-evm.c static int davinci_evm_probe(struct platform_device *pdev) · line 250
Quoted 3 lines
sound/soc/ti/davinci-evm.c +1
-1if (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" );
Nitpick: Could be snd_soc_register_card()
sound/soc/ti/davinci-evm.c static int davinci_evm_probe(struct platform_device *pdev) · line 253
Quoted 3 lines
sound/soc/ti/davinci-evm.c +0
-0goto err_put; }
CJ
Re: [PATCH 01/10] ASoC: ti: ams-delta: Use dev_err_probe() for error handling
In reply to Christophe JAILLETHi Christophe,
Thank you for your review.
Quoted 6 lines
Nitpick: could add some () (i.e.
snd_soc_register_card()) to match patch 9/10.CJ
I'll fix this in the next version.
Best regards,
Phuc
Re: [PATCH 02/10] ASoC: ti: davinci-evm: Use dev_err_probe() for error handling
In reply to Christophe JAILLETHi Christophe,
Thank you for your review.
Quoted 11 lines
Nitpick: this blank new line could be removed.
sound/soc/ti/davinci-evm.c static int davinci_evm_probe(struct platform_device *pdev) · line 250
Quoted 3 lines
if (ret) {sound/soc/ti/davinci-evm.c +1
-1-dev_err (&pdev->dev,"snd_soc_register_card failed (%d)\n" , ret); +dev_err_probe (&pdev->dev, ret,"snd_soc_register_card failed\n" );Nitpick: Could be
snd_soc_register_card()Quoted 3 lines
goto err_put; }
I'll fix this in the next version.
Best regards,
Phuc
Re: [PATCH 09/10] ASoC: ti: omap-twl4030: Use dev_err_probe() for error handling
In reply to [email protected]Quoted 7 lines · On Tue, 14 Jul 2026 19:00:41 +0700 [email protected] wrote:
From: bui duc phuc <[email protected]>
Replace
dev_err()withdev_err_probe()when reportingdevm_snd_soc_register_card()failures. This suppresses unnecessary log messages for deferred probe errors.Signed-off-by bui duc phuc <[email protected]>
Quoted 23 lines
--- sound/soc/ti/omap-twl4030.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)sound/soc/ti/omap-twl4030.c +3
-5@@ -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 ; }
Re: [PATCH 08/10] ASoC: ti: omap-twl4030: Return the original error code
In reply to [email protected]Quoted 16 lines · On Tue, 14 Jul 2026 19:00:40 +0700 [email protected] wrote:
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.Signed-off-by bui duc phuc <[email protected]>--- sound/soc/ti/omap-twl4030.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)sound/soc/ti/omap-twl4030.c +0
-0@@ -253,10 +253,9 @@ static int omap_twl4030_probe(struct platform_device *pdev)struct device_node *dai_node;
sound/soc/ti/omap-twl4030.c static int omap_twl4030_probe(struct platform_device *pdev) · line 259
Quoted 10 lines
sound/soc/ti/omap-twl4030.c +3
-4struct 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;
The error message seems that is wants to catch a non-existant property. snd_soc_of_parse_card_name() seems to ignore that error. Which is then really catched by devm_snd_soc_register_card(). It would be good to point out the error explicitely, so probably printing that error message on if (!card->name)
Regards,
Andreas
Re: [PATCH 08/10] ASoC: ti: omap-twl4030: Return the original error code
Hi Andreas,
Thanks for the review.
Quoted 6 lines
The error message seems that is wants to catch a non-existant property.
snd_soc_of_parse_card_name()seems to ignore that error. Which is then really catched bydevm_snd_soc_register_card(). It would be good to point out the error explicitely, so probably printing that error message on if (!card->name)
You're right, I can't be sure what the original author's intent was here. But as you pointed out, we do need to also check for if (!card->name), since snd_soc_of_parse_card_name() silently ignores a missing property and only returns an error for other cases.
This patch has already been merged, so I'll send a separate patch to address this.
Best regards,
Phuc
Quoted 8 lines · On 7/14/2026 2:00 PM, [email protected] wrote:
The changes fall into two categories:
1.Replacedev_err()withdev_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.
Quoted 11 lines
bui duc phuc (10):
ASoC: ti: ams-delta: Usedev_err_probe()for error handling
ASoC: ti: davinci-evm: Usedev_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: Usedev_err_probe()for error handling
ASoC: ti: omap-dmic: Usedev_err_probe()for error handling
ASoC: ti: omap-hdmi: Usedev_err_probe()for error handling
ASoC: ti: omap-twl4030: Return the original error code
ASoC: ti: omap-twl4030: Usedev_err_probe()for error handling
ASoC: ti: rx51: Usedev_err_probe()for error handling
If there are no dependencies between the 1) and 2), have all patches belonging to 1) lead the series before any 2)s pop up.
Right now you have three outstanding patches in the middle of the set that clearly differentiate from "Use dev_err_probe() for error handling" pattern like if you are about to hide something.
Which obviously you do not but the impression is there nonetheless.
Kind regards,
Czarek
Hi Cezary,
Thanks for the feedback.
Quoted 3 lines
Which obviously you do not but the impression is there nonetheless.
There's no way I could hide anything from the reviewers anyway. :)
Quoted 6 lines
If there are no dependencies between the 1) and 2), have all patches belonging to 1) lead the series before any 2)s pop up.
Right now you have three outstanding patches in the middle of the set that clearly differentiate from "Use
dev_err_probe()for error handling" pattern like if you are about to hide something.
From the earlier guard/scoped_guard series for Intel, I learned that you prefer grouping patches by topic rather than mixing different kinds of changes together.
I'm not sure whether other maintainers feel the same way, or would rather prioritize what's more convenient for the developer preparing the series.
Thanks again for the suggestion. I'll keep it in mind for future patch series.
Best regards,
Phuc