ASoC: rockchip: Simplify probe error handling
Subsystems (5)
cover ASoC: rockchip: Simplify probe error handling
From: bui duc phuc <[email protected]>
Hi all,
This series simplifies probe error handling across Rockchip ASoC drivers.
It replaces open-coded error handling with dev_err_probe() where appropriate, removes redundant probe error messages, returns the original error code directly, and fixes handling of -EPROBE_DEFER returned by platform_get_irq_optional() in the Rockchip SAI driver and devm_pinctrl_get() in the Rockchip I2S driver.
Compile tested only.
Best regards,
Phuc
bui duc phuc (14):
ASoC: rockchip: rk3288_hdmi_analog: Drop redundant probe error
messages
ASoC: rockchip: rk3288_hdmi_analog: Use dev_err_probe() for error
handling
ASoC: rockchip: rockchip_i2s: Use dev_err_probe() for error handling
ASoC: rockchip: rockchip_i2s: Drop redundant probe error messages
ASoC: rockchip: rockchip_i2s: Propagate -EPROBE_DEFER from
devm_pinctrl_get()
ASoC: rockchip: i2s-tdm: Inline PTR_ERR() in dev_err_probe()
ASoC: rockchip: i2s-tdm: Drop redundant probe error messages
ASoC: rockchip: rockchip_max98090: Drop redundant probe error messages
ASoC: rockchip: rockchip_pdm: Drop redundant probe error messages
ASoC: rockchip: rockchip_rt5645: Drop redundant probe error messages
ASoC: rockchip: rockchip_sai: Propagate -EPROBE_DEFER from IRQ lookup
ASoC: rockchip: rockchip_sai: Return the original error code
ASoC: rockchip: rockchip_sai: Drop redundant probe error messages
ASoC: rockchip: spdif: Return the original error code
sound/soc/rockchip/rk3288_hdmi_analog.c | 16 +++++-------- sound/soc/rockchip/rockchip_i2s.c | 30 +++++++++++-------------- sound/soc/rockchip/rockchip_i2s_tdm.c | 15 ++++--------- sound/soc/rockchip/rockchip_max98090.c | 5 +---- sound/soc/rockchip/rockchip_pdm.c | 8 ++----- sound/soc/rockchip/rockchip_rt5645.c | 5 +---- sound/soc/rockchip/rockchip_sai.c | 15 +++++-------- sound/soc/rockchip/rockchip_spdif.c | 4 ++-- 8 files changed, 34 insertions(+), 64 deletions(-)
Signature · 1 line
2.43.0
PATCH 1/14 ASoC: rockchip: rk3288_hdmi_analog: Drop redundant probe error messages
From: bui duc phuc <[email protected]>
Remove the probe error messages to avoid duplicate error reporting, since the error is already reported by the called functions.
--- sound/soc/rockchip/rk3288_hdmi_analog.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
sound/soc/rockchip/rk3288_hdmi_analog.c +2 -7
@@ -185,10 +185,8 @@ static int snd_rk_mc_probe(struct platform_device *pdev)gpiod_set_consumer_name (machine->gpio_hp_en,"hp_en" ); ret =snd_soc_of_parse_card_name (card,"rockchip,model" ); -if (ret) { -dev_err (card->dev,"SoC parse card name failed %d\n" , ret); +if (ret)return ret; - } rk_dailink.codecs[0].of_node = of_parse_phandle(np, "rockchip,audio-codec",
@@ -223,11 +221,8 @@ static int snd_rk_mc_probe(struct platform_device *pdev) rk_dailink.platforms->of_node = rk_dailink.cpus->of_node; ret =snd_soc_of_parse_audio_routing (card,"rockchip,routing" ); -if (ret) { -dev_err (&pdev->dev, -"Unable to parse 'rockchip,routing' property\n" ); +if (ret)return ret; - }snd_soc_card_set_drvdata (card, machine);
Signature · 1 line
2.43.0
PATCH 2/14 ASoC: rockchip: rk3288_hdmi_analog: 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.
--- sound/soc/rockchip/rk3288_hdmi_analog.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
sound/soc/rockchip/rk3288_hdmi_analog.c +3 -4
@@ -205,10 +205,9 @@ static int snd_rk_mc_probe(struct platform_device *pdev) } ret =snd_soc_get_dai_name (&args, &rk_dailink.codecs[0 ].dai_name); -if (ret) { -dev_err (&pdev->dev,"Unable to get codec_dai_name\n" ); -return ret; - } +if (ret) +return dev_err_probe (&pdev->dev, ret, +"Unable to get codec_dai_name\n" ); rk_dailink.cpus->of_node =of_parse_phandle (np,"rockchip,i2s-controller" ,0 );
Signature · 1 line
2.43.0
PATCH 3/14 ASoC: rockchip: rockchip_i2s: 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.
--- sound/soc/rockchip/rockchip_i2s.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
sound/soc/rockchip/rockchip_i2s.c +6 -8
@@ -767,16 +767,14 @@ static int rockchip_i2s_probe(struct platform_device *pdev)/* try to prepare related clocks */ i2s->hclk =devm_clk_get_enabled (&pdev->dev,"i2s_hclk" ); -if (IS_ERR (i2s->hclk)) { -dev_err (&pdev->dev,"Can't retrieve i2s bus clock\n" ); -return PTR_ERR (i2s->hclk); - } +if (IS_ERR (i2s->hclk)) +return dev_err_probe (&pdev->dev,PTR_ERR (i2s->hclk), +"Can't retrieve i2s bus clock\n" ); i2s->mclk =devm_clk_get (&pdev->dev,"i2s_clk" ); -if (IS_ERR (i2s->mclk)) { -dev_err (&pdev->dev,"Can't retrieve i2s master clock\n" ); -return PTR_ERR (i2s->mclk); - } +if (IS_ERR (i2s->mclk)) +return dev_err_probe (&pdev->dev,PTR_ERR (i2s->mclk), +"Can't retrieve i2s master clock\n" ); regs =devm_platform_get_and_ioremap_resource (pdev,0 , &res);if (IS_ERR (regs))
Signature · 1 line
2.43.0
PATCH 4/14 ASoC: rockchip: rockchip_i2s: Drop redundant probe error messages
In reply to [email protected]From: bui duc phuc <[email protected]>
Remove the probe error messages to avoid duplicate error reporting, since the error is already reported by the called functions.
--- sound/soc/rockchip/rockchip_i2s.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
sound/soc/rockchip/rockchip_i2s.c +2 -6
@@ -829,16 +829,12 @@ static int rockchip_i2s_probe(struct platform_device *pdev) &rockchip_i2s_component, dai, 1); -if (ret) { -dev_err (&pdev->dev,"Could not register DAI\n" ); +if (ret)return ret; - } ret =devm_snd_dmaengine_pcm_register (&pdev->dev,NULL ,0 ); -if (ret) { -dev_err (&pdev->dev,"Could not register PCM\n" ); +if (ret)return ret; - }return 0 ; }
Signature · 1 line
2.43.0
PATCH 5/14 ASoC: rockchip: rockchip_i2s: Propagate -EPROBE_DEFER from devm_pinctrl_get()
In reply to [email protected]From: bui duc phuc <[email protected]>
Return -EPROBE_DEFER from devm_pinctrl_get() instead of ignoring it and continuing probe. This allows the driver to be reprobed once the pinctrl provider becomes available.
--- sound/soc/rockchip/rockchip_i2s.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
sound/soc/rockchip/rockchip_i2s.c +5 -3
@@ -790,7 +790,11 @@ static int rockchip_i2s_probe(struct platform_device *pdev) i2s->bclk_ratio =64 ; i2s->pinctrl =devm_pinctrl_get (&pdev->dev); -if (!IS_ERR (i2s->pinctrl)) { +if (IS_ERR (i2s->pinctrl)) { +if (PTR_ERR (i2s->pinctrl) == -EPROBE_DEFER ) +return -EPROBE_DEFER ; +dev_dbg (&pdev->dev,"failed to find i2s pinctrl\n" ); + }else { i2s->bclk_on =pinctrl_lookup_state (i2s->pinctrl,"bclk_on" );if (!IS_ERR_OR_NULL (i2s->bclk_on)) { i2s->bclk_off =pinctrl_lookup_state (i2s->pinctrl,"bclk_off" );
@@ -799,8 +803,6 @@ static int rockchip_i2s_probe(struct platform_device *pdev)return -EINVAL ; } } - }else { -dev_dbg (&pdev->dev,"failed to find i2s pinctrl\n" ); }i2s_pinctrl_select_bclk_off (i2s);
Signature · 1 line
2.43.0
PATCH 6/14 ASoC: rockchip: i2s-tdm: Inline PTR_ERR() in dev_err_probe()
In reply to [email protected]From: bui duc phuc <[email protected]>
Pass PTR_ERR() directly to dev_err_probe() and avoid assigning it to the local variable first.
--- sound/soc/rockchip/rockchip_i2s_tdm.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
sound/soc/rockchip/rockchip_i2s_tdm.c +2 -4
@@ -1263,16 +1263,14 @@ static int rockchip_i2s_tdm_probe(struct platform_device *pdev) i2s_tdm->tx_reset =devm_reset_control_get_optional_exclusive (&pdev->dev,"tx-m" );if (IS_ERR (i2s_tdm->tx_reset)) { - ret =PTR_ERR (i2s_tdm->tx_reset); -return dev_err_probe (i2s_tdm->dev, ret, +return dev_err_probe (i2s_tdm->dev,PTR_ERR (i2s_tdm->tx_reset),"Error in tx-m reset control\n" ); } i2s_tdm->rx_reset =devm_reset_control_get_optional_exclusive (&pdev->dev,"rx-m" );if (IS_ERR (i2s_tdm->rx_reset)) { - ret =PTR_ERR (i2s_tdm->rx_reset); -return dev_err_probe (i2s_tdm->dev, ret, +return dev_err_probe (i2s_tdm->dev,PTR_ERR (i2s_tdm->rx_reset),"Error in rx-m reset control\n" ); }
Signature · 1 line
2.43.0
PATCH 7/14 ASoC: rockchip: i2s-tdm: Drop redundant probe error messages
In reply to [email protected]From: bui duc phuc <[email protected]>
Remove the probe error messages to avoid duplicate error reporting, since the error is already reported by the called functions.
--- sound/soc/rockchip/rockchip_i2s_tdm.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
sound/soc/rockchip/rockchip_i2s_tdm.c +2 -7
@@ -1361,17 +1361,12 @@ static int rockchip_i2s_tdm_probe(struct platform_device *pdev) ret =devm_snd_soc_register_component (&pdev->dev, &rockchip_i2s_tdm_component, i2s_tdm->dai,1 ); - -if (ret) { -dev_err (&pdev->dev,"Could not register DAI\n" ); +if (ret) goto err_suspend; - } ret =devm_snd_dmaengine_pcm_register (&pdev->dev,NULL ,0 ); -if (ret) { -dev_err (&pdev->dev,"Could not register PCM\n" ); +if (ret) goto err_suspend; - }return 0 ;
Signature · 1 line
2.43.0
PATCH 8/14 ASoC: rockchip: rockchip_max98090: Drop redundant probe error messages
In reply to [email protected]From: bui duc phuc <[email protected]>
Remove the probe error messages to avoid duplicate error reporting, since the error is already reported by the called functions.
--- sound/soc/rockchip/rockchip_max98090.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
sound/soc/rockchip/rockchip_max98090.c +1 -4
@@ -428,11 +428,8 @@ static int snd_rk_mc_probe(struct platform_device *pdev)/* Parse card name. */ ret =snd_soc_of_parse_card_name (card,"rockchip,model" ); -if (ret) { -dev_err (&pdev->dev, -"Soc parse card name failed %d\n" , ret); +if (ret)return ret; - }/* register the soc card */ ret =devm_snd_soc_register_card (&pdev->dev, card);
Signature · 1 line
2.43.0
PATCH 9/14 ASoC: rockchip: rockchip_pdm: Drop redundant probe error messages
In reply to [email protected]From: bui duc phuc <[email protected]>
Remove the probe error messages to avoid duplicate error reporting, since the error is already reported by the called functions.
--- sound/soc/rockchip/rockchip_pdm.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
sound/soc/rockchip/rockchip_pdm.c +2 -6
@@ -630,10 +630,8 @@ static int rockchip_pdm_probe(struct platform_device *pdev) &rockchip_pdm_component, &rockchip_pdm_dai, 1); -if (ret) { -dev_err (&pdev->dev,"could not register dai: %d\n" , ret); +if (ret) goto err_suspend; - }rockchip_pdm_rxctrl (pdm,0 );
@@ -642,10 +640,8 @@ static int rockchip_pdm_probe(struct platform_device *pdev) goto err_suspend; ret =devm_snd_dmaengine_pcm_register (&pdev->dev,NULL ,0 ); -if (ret) { -dev_err (&pdev->dev,"could not register pcm: %d\n" , ret); +if (ret) goto err_suspend; - }return 0 ;
Signature · 1 line
2.43.0
PATCH 10/14 ASoC: rockchip: rockchip_rt5645: Drop redundant probe error messages
In reply to [email protected]From: bui duc phuc <[email protected]>
Remove the probe error messages to avoid duplicate error reporting, since the error is already reported by the called functions.
--- sound/soc/rockchip/rockchip_rt5645.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
sound/soc/rockchip/rockchip_rt5645.c +1 -4
@@ -191,11 +191,8 @@ static int snd_rk_mc_probe(struct platform_device *pdev) rk_dailink.platforms->of_node = rk_dailink.cpus->of_node; ret =snd_soc_of_parse_card_name (card,"rockchip,model" ); -if (ret) { -dev_err (&pdev->dev, -"Soc parse card name failed %d\n" , ret); +if (ret) goto put_cpu_of_node; - } ret =devm_snd_soc_register_card (&pdev->dev, card);if (ret) {
Signature · 1 line
2.43.0
PATCH 11/14 ASoC: rockchip: rockchip_sai: Propagate -EPROBE_DEFER from IRQ lookup
In reply to [email protected]From: bui duc phuc <[email protected]>
Return -EPROBE_DEFER from platform_get_irq_optional() so the driver is re-probed when the interrupt resource becomes available instead of continuing probe without an IRQ.
--- sound/soc/rockchip/rockchip_sai.c | 2 ++ 1 file changed, 2 insertions(+)
sound/soc/rockchip/rockchip_sai.c +2 -0
@@ -1428,6 +1428,8 @@ static int rockchip_sai_probe(struct platform_device *pdev) "Failed to initialize regmap\n"); irq =platform_get_irq_optional (pdev,0 ); +if (irq == -EPROBE_DEFER ) +return irq;if (irq >0 ) { ret =devm_request_irq (&pdev->dev, irq, rockchip_sai_isr,IRQF_SHARED , node->name, sai);
Signature · 1 line
2.43.0
PATCH 12/14 ASoC: rockchip: rockchip_sai: Return the original error code
In reply to [email protected]From: bui duc phuc <[email protected]>
Return the original error code directly and drop the redundant error message since the called function already reports the failure.
--- sound/soc/rockchip/rockchip_sai.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
sound/soc/rockchip/rockchip_sai.c +2 -3
@@ -1434,8 +1434,7 @@ static int rockchip_sai_probe(struct platform_device *pdev) ret =devm_request_irq (&pdev->dev, irq, rockchip_sai_isr,IRQF_SHARED , node->name, sai);if (ret) -return dev_err_probe (&pdev->dev, ret, -"Failed to request irq %d\n" , irq); +return ret; }else {dev_dbg (&pdev->dev,"Asked for an IRQ but got %d\n" , irq); }
@@ -1458,7 +1457,7 @@ static int rockchip_sai_probe(struct platform_device *pdev) ret =rockchip_sai_parse_paths (sai, node);if (ret) -return dev_err_probe (&pdev->dev, ret,"Failed to parse paths\n" ); +return ret;/* * From here on, all register accesses need to be wrapped in
Signature · 1 line
2.43.0
PATCH 13/14 ASoC: rockchip: rockchip_sai: Drop redundant probe error messages
In reply to [email protected]From: bui duc phuc <[email protected]>
Remove the probe error messages to avoid duplicate error reporting, since the error is already reported by the called functions.
--- sound/soc/rockchip/rockchip_sai.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
sound/soc/rockchip/rockchip_sai.c +2 -6
@@ -1472,18 +1472,14 @@ static int rockchip_sai_probe(struct platform_device *pdev)return dev_err_probe (&pdev->dev, ret,"Failed to resume device\n" ); ret =devm_snd_dmaengine_pcm_register (&pdev->dev,NULL ,0 ); -if (ret) { -dev_err (&pdev->dev,"Failed to register PCM: %d\n" , ret); +if (ret) goto err_runtime_suspend; - } ret =devm_snd_soc_register_component (&pdev->dev, &rockchip_sai_component, dai,1 ); -if (ret) { -dev_err (&pdev->dev,"Failed to register component: %d\n" , ret); +if (ret) goto err_runtime_suspend; - }pm_runtime_use_autosuspend (&pdev->dev);pm_runtime_put (&pdev->dev);
Signature · 1 line
2.43.0
PATCH 14/14 ASoC: rockchip: spdif: Return the original error code
In reply to [email protected]From: bui duc phuc <[email protected]>
Return the original error code directly and drop the redundant error message since the called function already reports the failure.
--- sound/soc/rockchip/rockchip_spdif.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/rockchip/rockchip_spdif.c +2 -2
@@ -396,13 +396,13 @@ static int rk_spdif_probe(struct platform_device *pdev) ret =devm_snd_dmaengine_pcm_register (&pdev->dev,NULL ,0 );if (ret) -return dev_err_probe (&pdev->dev, ret,"Could not register PCM\n" ); +return ret; ret =devm_snd_soc_register_component (&pdev->dev, &rk_spdif_component, &rk_spdif_dai,1 );if (ret) -return dev_err_probe (&pdev->dev, ret,"Could not register DAI\n" ); +return ret;return 0 ; }
Signature · 1 line
2.43.0
Mark Brown
maintainerQuoted 9 lines · On Thu, 06 Aug 2026 12:21:22 +0700, [email protected] wrote:
ASoC: rockchip: Simplify probe error handling
From: bui duc phuc <[email protected]>
Hi all,
This series simplifies probe error handling across Rockchip ASoC drivers.
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.3
Thanks!
[01/14] ASoC: rockchip: rk3288_hdmi_analog: Drop redundant probe error messages
https://git.kernel.org/broonie/sound/c/931f4a1223e1 [02/14] ASoC: rockchip: rk3288_hdmi_analog: Use dev_err_probe() for error handling https://git.kernel.org/broonie/sound/c/06f5854050f5 [03/14] ASoC: rockchip: rockchip_i2s: Use dev_err_probe() for error handling https://git.kernel.org/broonie/sound/c/b5e4b1159743 [04/14] ASoC: rockchip: rockchip_i2s: Drop redundant probe error messages https://git.kernel.org/broonie/sound/c/c1bf7ae0c87a [05/14] ASoC: rockchip: rockchip_i2s: Propagate -EPROBE_DEFER from devm_pinctrl_get() https://git.kernel.org/broonie/sound/c/be4f82d15235 [06/14] ASoC: rockchip: i2s-tdm: Inline PTR_ERR() in dev_err_probe() https://git.kernel.org/broonie/sound/c/334d5ea7582b [07/14] ASoC: rockchip: i2s-tdm: Drop redundant probe error messages https://git.kernel.org/broonie/sound/c/9fea4805ed95 [08/14] ASoC: rockchip: rockchip_max98090: Drop redundant probe error messages https://git.kernel.org/broonie/sound/c/de983524dcbe [09/14] ASoC: rockchip: rockchip_pdm: Drop redundant probe error messages https://git.kernel.org/broonie/sound/c/7d3f7eb890f1 [10/14] ASoC: rockchip: rockchip_rt5645: Drop redundant probe error messages https://git.kernel.org/broonie/sound/c/b300f1313b00 [11/14] ASoC: rockchip: rockchip_sai: Propagate -EPROBE_DEFER from IRQ lookup https://git.kernel.org/broonie/sound/c/c97bdbf862c6 [12/14] ASoC: rockchip: rockchip_sai: Return the original error code https://git.kernel.org/broonie/sound/c/7a2229ef7cdb [13/14] ASoC: rockchip: rockchip_sai: Drop redundant probe error messages https://git.kernel.org/broonie/sound/c/26c9632c33f7 [14/14] ASoC: rockchip: spdif: Return the original error code https://git.kernel.org/broonie/sound/c/5784ef446847
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